User-341994687 posted
Hi,
I am trying to convert an empty string, int etc to a null type in the database. I have a seperate data access layer. So in the class in the insert I have the following.
SqlParameter
paramADVehMake = new
SqlParameter("@AD_Veh_Make",
SqlDbType.VarChar, 10);
if ( ad.getVehicleMake() ==
null || ad.getVehicleMake ==
"")
{
paramADVehMake.Value = System.
DBNull.Value;
}
else
{
paramADVehMake.Value = ad.getVehicleMake();
}
But I am getting an error for the DBNull. Can anyone show me where I am going wrong.
Thanks in advance,
Seamus McMahon