VB6 ADODB.Recordset RecordCount property always returns -1

前端 未结 12 1812
别跟我提以往
别跟我提以往 2020-12-11 15:43

I am trying to get some old VB6 code to work with SQL Server Compact.

I can connect, open the database and all seems well. I can run insert select commands which

12条回答
  •  情深已故
    2020-12-11 16:17

    Set cn = CreateObject("ADODB.Connection")
    
    strVerb = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
        "Data Source=C:\test.accdb"
    
    tab1 = "tabelle1"
    
    strSQL = "SELECT Count(*) FROM " & tab1
    
    Debug.Print strSQL
             
    cn.Open strVerb
    Set rs = cn.Execute(strSQL)
    
    Debug.Print rs.Fields(0)
        
    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
    

提交回复
热议问题