厄,下面是我程序里面的一段,可以正常运行。
怀疑你是不是漏了
byte[] buffer = new byte[stream.Length];类似的一句话,而且FileStream实例化少参数System.IO.FileStream stream = new System.IO.FileStream(FilePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, (int)stream.Length);
stream.Close();
this.sqlConn.Open();
SqlCommand cmd=new SqlCommand("UPDATE Notify SET NotifyData=@NotifyData where NotifyId=@NotifyId",this.sqlConn);
cmd.Parameters.Add("@NotifyData",SqlDbType.Image).Value=buffer;
cmd.Parameters.Add("@NotifyId",SqlDbType.Int).Value=NotifyId;
cmd.ExecuteNonQuery();
this.sqlConn.Close();