Image refresh error with OLEDB

I am working on a C # Visual Studio 2005 window. I am saving an image to SQL Server using OLEDB command. When pasting, I am inserting a null value into the image field. It works well, but the problem occurs when I try to update the image. My update request:

using (OleDbCommand Update = new OleDbCommand(
                 "UPDATE [BoardDetail] SET BoardImage= '(?)' WHERE BoardID='" + oItem.BoardID + "' AND BoardSerialNo='" + oItem.BoardSerialNo + "' ", connection))             
             {
                 OleDbParameter imageParameter =
                 Update.Parameters.Add("@image", OleDbType.Binary);
                 imageParameter.Value = content;
                 imageParameter.Size = content.Length;
                 Update.ExecuteNonQuery();
             }

      

it works well, but the value in the image column is null.

+1


a source to share


1 answer


The problem is with the definition of the parameter. The change:

SET BoardImage= '(?)' 

      



to

SET BoardImage= @image

      

0


a source







All Articles