如何存储Bitmap对象到DataSet里

longbow74 2003-04-14 02:57:17
?
...全文
92 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
longbow74 2003-04-16
  • 打赏
  • 举报
回复
我用的是一个Strongtype的dataSet(报表用),请问放image的字段用什么类型?
NaZiChong 2003-04-15
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/1446/1446130.xml?temp=1.383609E-02
saucer 2003-04-15
  • 打赏
  • 举报
回复
make the DataColumn of byte array type, then you can do try something like (VB):

Dim ms As New IO.MemoryStream()
Dim p As New Bitmap("c:\fish.bmp")
p.Save(ms, p.RawFormat)
Dim arrImage() As Byte = ms.GetBuffer

'create a new row of data in the dataset
Dim r As DataSet1.Table2Row = DataSet11.Photos.NewTable2Row
r.name = "fish"
'set the picture field of the dataset row to the Byte array
r.picture = arrImage

'add the row to the dataset
DataSet11.Photos.Rows.Add(r)

'save the data in the dataset to the database
OleDbDataAdapter1.Update(DataSet11)


http://groups.google.com/groups?q=bitmap+save+dataset+picturebox+memorystream&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=Os1JpBupCHA.2796%40TK2MSFTNGP10&rnum=1
jcaomao 2003-04-15
  • 打赏
  • 举报
回复
把字段设成hexbinary应该就可以了。
韩小明 2003-04-14
  • 打赏
  • 举报
回复
gz
longbow74 2003-04-14
  • 打赏
  • 举报
回复
定义DataSet的时候怎么把字段定义为BLOB类型的
hzg_yujia 2003-04-14
  • 打赏
  • 举报
回复
不能。
bitmap以BLOB形式存储。
在.Net中,必须先存储一条此字段为空的记录,然后再利用Parameter对象Update这条记录为BlOB字段赋值。

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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