VB6 ADODB.Recordset RecordCount property always returns -1

前端 未结 12 1820
别跟我提以往
别跟我提以往 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:39

    Below code might help you,

    set conn = CreateObject("ADODB.Connection") 
    conn.open "" 
    set rs = CreateObject("ADODB.Recordset") 
    sql = "SELECT columns FROM table WHERE [...]" 
    rs.open sql,conn,1,1 
    if not rs.eof then 
        nr = rs.recordcount 
        response.write "There were " & nr & " matches." 
        ' ... process real results here ... 
    else 
        response.write "No matches." 
    end if 
    rs.close: set rs = nothing 
    conn.close: set conn = nothing 
    

提交回复
热议问题