Hi, I have a table with a nullable column.
When I try to insert a record using INSERT statement I pass a parameter set to the value DBNull.Value.
Then I get an error from the SqlServer saying that the parameter was not supplied.
Using Sql-profiler i see that the applied parameter is set to the keyword 'default'.
I try to run the query inside Sql Server Management Studio, it looks something like this:
exec sp_executesql N'INSERT INTO [tbl] ([Val1]) VALUES (@Val1_P)', @Val1_P=default
First, why is the server giving the error about parameter not supplied? I have supplied it, and the value is keyword default.
Then I try to change the query to setting @Val1_P=null. This works..
BUT the problem then is, how do I set this from ADO Command object? I have set the parameter to DbNull.Value, and it translate it to 'default'.. What's going on here? I wanted the parameter to be the keyword 'null' not 'default'.
Any suggestions? Thank you in advance!
View Complete Post