您的位置:程序门 -> vb -> 数据库(包含打印,安装,报表)



不知道为什么,老提示 实时错误 类型不匹配


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


不知道为什么,老提示 实时错误 类型不匹配[已结贴,结贴人:chaozhou]
发表于:2007-04-04 16:47:02 楼主
在写access数据二进制图片时候,如下代码:

                dim   numblocks           as   integer
                dim   leftover           as   long
                dim   bytedata()           as   byte     '字节数组
                dim   destfile           as   integer,   i   as   integer
                dim   colsize   as   long
                dim   blocksize   as   integer
                blocksize   =   256
                colsize   =   col.actualsize
                destfile   =   freefile
                open   filename   for   binary   access   write   as   destfile
                numblocks   =   colsize   \   blocksize
                leftover   =   colsize   mod   blocksize
                if   col.type   =   adlongvarbinary   then
                        if   leftover   >   0   then
                                redim   bytedata(leftover)
                                bytedata()   =   col.getchunk(leftover)
                                ‘col.getchunk   (leftover)
                                put   destfile,   ,   bytedata()
                        end   if
                        redim   bytedata(blocksize)
                        for   i   =   1   to   numblocks
                                bytedata()   =   col.getchunk(blocksize)
                                'col.getchunk   (blocksize)
                                put   destfile,   ,   bytedata()
                        next
                end   if
                close   destfile


到bytedata()   =   col.getchunk(blocksize)这一行老提示::

实时错误   类型不匹配
发表于:2007-04-04 16:49:091楼 得分:5
binary类型的最好用command+parameter来写。
发表于:2007-04-04 17:02:262楼 得分:0
command+parameter   什么意思啊

奇怪是我函数第一次执行就没事,第二次就有事了
发表于:2007-04-04 17:25:463楼 得分:0
getchunk()     读完数据后,指针怎么返回最前头,因为读完后,再读就出现错误了。
每当记录指针移动到一条记录上,就读取记录数据,但是如何两次移动都在同一记录
上,就会造成两次getchunk读取   二进制字段,造成错误,请大家帮忙。
发表于:2007-04-04 18:21:394楼 得分:10
http://www.china-askpro.com/msg41/qa82.shtml
请仔细对照上面地址的代码和分析。
发表于:2007-04-05 11:38:065楼 得分:0
那错误找到了,我用的是adodc.recordset   而不是adodc.recordset   的new对象。
为什么用adodc.recordset对象不行呢?   就是第一getchunk完后,记录移动到其它记录
在getchunk就出现上面说的错误了。
发表于:2007-04-05 12:06:006楼 得分:0
adodc1.recordset.fields().getchunk   的错误
发表于:2007-04-06 10:06:457楼 得分:5
set   bytedata   =   col.getchunk(blocksize)


快速检索

最新资讯
热门点击