为什么我从SQL数据库读书的图片再写保存回数据就会出错,如果是从硬盘上选的图片就不会出错。谢谢!

Angelnet 2003-08-30 03:14:30
Dim arrPicture() As Byte = CType(dsPictures.Tables(0).Rows(0)("E_PICTURE"), Byte())
Dim ms As New MemoryStream(arrPicture)
With PictureBox1
.Image = Image.FromStream(ms)
.SizeMode = PictureBoxSizeMode.CenterImage
End With ‘从数据库读书图片的代码

...全文
91 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
Angelnet 2003-08-31
  • 打赏
  • 举报
回复
http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=J9UBRVER-L3VB-49M3-GOU1-Z6C2PVR6FZ3K

看问题已解决,谢谢谢谢各位,上面网址是解决的办法
canyqf 2003-08-30
  • 打赏
  • 举报
回复
去掉ms.close()
Latitude 2003-08-30
  • 打赏
  • 举报
回复
看一下Montaque的文章:
http://www.csdn.net/develop/read_article.asp?id=14963
rouser 2003-08-30
  • 打赏
  • 举报
回复
讀出來先,然後直接存到本地,再接著讀到另一個表中
呵呵
是有點囉嗦
Angelnet 2003-08-30
  • 打赏
  • 举报
回复
这样还是不行,如果我要把读出来的图片存另一个表怎么办?
Angelnet 2003-08-30
  • 打赏
  • 举报
回复
看来只有判断pictrue里的图片有没有修改了,不过这样好像不爽
rouser 2003-08-30
  • 打赏
  • 举报
回复
幫你UP!
Angelnet 2003-08-30
  • 打赏
  • 举报
回复
难道真的办法了吗
rouser 2003-08-30
  • 打赏
  • 举报
回复
Dim img AS SqlParameter
img = New SqlParameter("@Picture", SqlDbType.Image)
img.Value = arrImage
.Parameters.Add(img)

我覺得你的代碼沒錯呀

那你就存為一個本地文件再讀進數據庫吧
Angelnet 2003-08-30
  • 打赏
  • 举报
回复
Dim ms As New MemoryStream()
PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)
Dim arrImage() As Byte = ms.GetBuffer
ms.Close()

With cmdSqlServer
.Connection = cn
.CommandType = CommandType.Text
.CommandText = "UPDATE tblEmployeeSystem SET E_PICTURE=@Picture WHERE E_NO='" & strNO & "'"
.Parameters.Add(New SqlParameter("@Picture", SqlDbType.Image)).Value = arrImage
.ExecuteNonQuery()
End With
rouser 2003-08-30
  • 打赏
  • 举报
回复
保存的代碼貼出來看看

16,549

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧