1

I work on C# window Visual Studio 2005. I save image on SQL Server using OLEDB command. In insertion I insert null value on image field. It works well, but a problem occurs when I try to update image. My update query is:

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 value on image column is null.

4

1 に答える 1

0

問題は、パラメータの定義にあります。変化する:

SET BoardImage= '(?)' 

SET BoardImage= @image
于 2011-11-14T22:31:18.737 に答える