怎样用VB保存图像文件

tw 2000-06-17 09:04:00
请教:
怎样用VB把图像文件存入数据库中(MSSQL7或MS-ACCESS)?
谢谢赐教
...全文
213 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
apollo 2000-06-18
  • 打赏
  • 举报
回复
...
chen1256 2000-06-17
  • 打赏
  • 举报
回复
Open Me.CommonDialog1.FileName For Binary As #1
ReDim bit(LOF(1)) As Byte
Get 1, 1, bit
Close 1
'然后将字节数组的内容写入数据库即可
'Set rst = New ADODB.Recordset
Dim cnn As New ADODB.Connection, rst As New ADODB.Recordset
cnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=(local)"
rst.Open "test1", cnn, adOpenKeyset, adLockOptimistic
rst.AddNew
rst("No") = 2003
rst("Comment") = "aaaa you!"
rst("image").AppendChunk bit
rst.Update
Wingsun 2000-06-17
  • 打赏
  • 举报
回复
使用Field对象的AppendChunk和GetChunk方法来存取图像

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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