A
Alasdair Thomson
Hi,
I have a SQL Server database with a column of type "Image" that I am
using to store bitmaps. I am able to store and retrieve bitmaps from
C# using well documented methods on various internet sites but since
my bitmap is optional I also need the ability to insert a null into
this column.
Using the following code gives an error for an INSERT command:
sqlCmd.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Picture",
System.Data.SqlDbType.VarBinary, 2147483647, "Picture"));
sqlCmd.Parameters["@Picture"].Value = DBNull.Value;
sqlCmd.ExecuteNonQuery();
Upon the execute, I get the error
"An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll
Additional information: System error."
Can somebody help me please and explain how it is possible to insert a
NULL into an Image column since the DBNull.Value does not appear to
work.
Kind Regards
Alasdair
I have a SQL Server database with a column of type "Image" that I am
using to store bitmaps. I am able to store and retrieve bitmaps from
C# using well documented methods on various internet sites but since
my bitmap is optional I also need the ability to insert a null into
this column.
Using the following code gives an error for an INSERT command:
sqlCmd.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Picture",
System.Data.SqlDbType.VarBinary, 2147483647, "Picture"));
sqlCmd.Parameters["@Picture"].Value = DBNull.Value;
sqlCmd.ExecuteNonQuery();
Upon the execute, I get the error
"An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll
Additional information: System error."
Can somebody help me please and explain how it is possible to insert a
NULL into an Image column since the DBNull.Value does not appear to
work.
Kind Regards
Alasdair