Set rs1 = New ADODB.Recordset
  strSQL1 = "select * from table_name"
  rs1.Open strSQL1, cnn, adOpenKeyset, adLockOptimistic
  If Not (rs1.RecordCount > 0) Then
    MsgBox "找不到合约属性", vbOKOnly, "提示信息"
  End If这段代码可解决第二个问题,一定要用记录集,才可以返回记录数.

解决方案 »

  1.   

    Set rst1 = UploadCnxn.Execute("select * from ddindextable where 索引号='" & CInt(Mid(buffer5, 28, 3)) & "'", RecordNumber, adCmdText) '此语句有错误
    -----------
    索引号为整型,那 索引号='" & CInt(Mid(buffer5, 28, 3)) & "'"
    是错误的,应该不要'号 索引号=" & CInt(Mid(buffer5, 28, 3)) 
      

  2.   

    哦不好意思,我上面说错了,
    你的错误应该是在CINT()
    你想 字符串跟整型连接,当然报类型出错呀。