B
Benjamin Walling
When using SqlParameters, it appears that any time you set the value to
dbnull.value, it causes the variable to be declared as nvarchar(4000) in
the prepared statement (you can check this in Profiler). This seems to
work for most data types, but does not work for binary data types. I
have a nullable column of binary data type. I can correctly update the
column with data using a parameter when there is data for the column. I
cannot do it when the column needs to be null. I get a syntax error
converting nvarchar to binary. No amount of explicitly definining the
dbtype or the sqldbtype or the isnullable will change this behavior.
How do I insert/update a binary column with a null value using a SQL
paramenter?
dbnull.value, it causes the variable to be declared as nvarchar(4000) in
the prepared statement (you can check this in Profiler). This seems to
work for most data types, but does not work for binary data types. I
have a nullable column of binary data type. I can correctly update the
column with data using a parameter when there is data for the column. I
cannot do it when the column needs to be null. I get a syntax error
converting nvarchar to binary. No amount of explicitly definining the
dbtype or the sqldbtype or the isnullable will change this behavior.
How do I insert/update a binary column with a null value using a SQL
paramenter?