关于获取SQL SERVER中图像的问题。

masterkey 2000-06-23 10:24:00
我原来打算用如下的程序来显示SQL SERVER的图像,第一次获取时不会有问题,但获取第二张图像时,程序执行到标示的第6 行即告诉我错误13:类型不匹配,为什么呢?
后来我只用PICTURE 绑定到数据控件上。 可是到底为什么第二次就不行了呢?
dim intDataFile as integer
dim lngFileSize as long
dim binPicture() as byte

1 intDataFile = 1
2 if len(dir("pictemp.bmp")) then kill "pictemp.bmp"
3 open "pictemp.bmp" for binary access write as intDataFile
4 lngFileSize = adodc1.recordset("EmpImage").actualsize
5 ReDim binPicture(lngFileSize)
6 binPicture() = adodc1.recordset("EmpImage").Getchunk(lngFileSize)
7 put intDataFile,,binpicture()
8 Close intDataFile

txtFileName.text = "pictemp.bmp"
picture1.picture =loadpicture(txtfilename.text)
...全文
85 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ykgzh 2000-08-20
  • 打赏
  • 举报
回复
试试先Binary方式打开文件,将其写入一个字节型数组中,然后直接Fields.Value=此数组。显示时方法反过来,这样用会比你的方法好一些。
Un1 2000-06-23
  • 打赏
  • 举报
回复
把第5句改为:
erase binPicture
liyang 2000-06-23
  • 打赏
  • 举报
回复

会不会该条纪录该字段为NULL?

附:
你如果使用ado,可以不用getchunk,直接赋值

7,759

社区成员

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

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