I have this column in my table that is nullable, and when I execute a store procedure that does an insert via SQL Server Manager and I have a null value for the parameter for that column it does not complain and works
EXEC @return_value = my_store_proc
@my_last_name = NULL, ...
but in my C# code where I am building the parameter it complains
System.Data.SqlClient.SqlException : Procedure or function 'my_store_proc' expects
parameter ' @my_last_name', which was not supplied.
here is my C# code
command.Parameters.AddWithValue("@my_last_name ", null);
but when I replace the null with an empty string it works perfectly fine. I am not sure why it does not like null here. Also I tried using DbNull.value in place of null, but can not seem to find System.DBNull when I try to add a reference so I am looking for other alternative.
DBNullis inmscorlib, what are you trying to add a reference to?