我用ADO得到一个大数值.在句:iCount = iRS.Fields("DZNR").ActualSize
    iSZ = iRS.Fields("DZNR").GetChunk(iCount)
时如果遇到一个$美元符样的字符时就报错:应用程序在当前操作中使用了错误类型的值.奇怪的是在有的机子上报错,在有的机子上却不报错,可以正常运行.
程序如下:
Option ExplicitPrivate iConn As New ADODB.Connection
Private iRS As New ADODB.Recordset
Private iFSO As New FileSystemObject
Dim iTxt  As TextStream
    Dim iCount As Long
    Dim iSZ As String
        
    iConn.ConnectionString = "Provider=OraOLEDB.Oracle.1;Password=tmsnew;Persist Security Info=True;User ID=tms;Data Source=qs"
    iConn.Open
    
    iRS.ActiveConnection = iConn
    iRS.CursorLocation = adUseClient
    
    iRS.Open "select * from dzdz where dzlx = '29'", , adOpenKeyset, adLockBatchOptimistic
    
    iRS.MoveFirst
    If (iRS.BOF And iRS.EOF) Then
        MsgBox ("没有记录")
        Return
    End If
    
    iCount = iRS.Fields("DZNR").ActualSize
    
    
    iSZ = iRS.Fields("DZNR").GetChunk(iCount)
    Set iTxt = iFSO.CreateTextFile("C:\Text.txt", True, False)
    iTxt.Write (iSZ)
    iTxt.Close
    

解决方案 »

  1.   

    急,给100分.在GetChunk时报:应用程序在当前操作中使用了错误类型的值. 大家帮帮我啊!!真的很需要你们的帮助.
      

  2.   

    '用Replace将"$"去掉.
    iCount = val(Replace(str(iRS.Fields("DZNR").ActualSize),"$",""))
      

  3.   

    现在主要是在句:iRS.Fields("DZNR").GetChunk(iCount) 就报错! 无法用到chr($的ASCLL码).大家帮帮我啊!!
      

  4.   

    我自已解决了!原来把iCount = iRS.Fields("DZNR").ActualSize
        
        
     iSZ = iRS.Fields("DZNR").GetChunk(iCount)写成:iCount = iRS.Fields("DZNR").ActualSize
        
        
        iSZ = iRS.Fields("DZNR").value就可以了,好笨的!!!