I add parameters to Sqldatasource control dynamically from code behind.
sq1.UpdateParameters.Clear();
sq1.UpdateCommand = "sp_upn";
sq1.UpdateCommandType = SqlDataSourceCommandType.StoredProcedure;
is there a better way to add null parameter ?better than code below?(set value to null just when adding, not later)
sq1.UpdateParameters.Add("imgid","");
sq1.UpdateParameters["imgid"].DefaultValue = null;
UPDATED The parameter is not always NULL.It may have Int value based on condition.( if user uploaded an image)
I am using Sqldatasource Control and not a sqlcommand and I can not use:
cmd.Parameters.AddWithValue("imgid", DBNull.Value);
DbTypehelp?