厄,下面是我程序里面的一段,可以正常运行。
怀疑你是不是漏了
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();
怀疑你是不是漏了
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();
解决方案 »
- 手机记事本数据结构的设计
- 正则表达式获取字符串中指定字符并写入数组
- ###详解如何在GridView中显示图片或链接(当不能确定哪一列中含有图片或链接时)###
- 如何得到线程号?
- Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
- 这道题该怎么答???
- ADDIN插件如何获取当前Project中一个自定义类的实例
- dataset里同一个table的两个字段的值相减?
- 请大家帮我看下那里有问题:未将对象引用设置到对象的实例
- 为什么这个事件处理函数不执行?
- 各位帮帮我,我已经烦恼好长时间了!是关于dataset里tables里如何给一行动态增加值(在线等)
- [紧急求助]在页面中以只读的方式显示Word文本内容?
可以给我一段完整的程序吗 谢谢了