首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

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

2012-01-05 
不知道为什么,老提示 实时错误 类型不匹配在写access数据二进制图片时候,如下代码:DimNumBlocksAsIntegerD

不知道为什么,老提示 实时错误 类型不匹配
在写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)这一行老提示::

实时错误   类型不匹配

------解决方案--------------------


Binary类型的最好用command+parameter来写。
[解决办法]
http://www.china-askpro.com/msg41/qa82.shtml
请仔细对照上面地址的代码和分析。
[解决办法]
set byteData = Col.GetChunk(BlockSize)

热点排行