Results 1 to 2 of 2

Thread: What Am I missing in ADO /SQL satement

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154
    When I run this query I get back rs.AbsolutePosition = -1 and I know I have records in there. I am Running VB5 and SQL Server 7.0


    Dim cn As New ADODB.Connection
    Dim cm As New ADODB.Command
    Dim rs As New ADODB.Recordset

    cn.Open "provider=SQLOLEDB.1;" & _
    "Password=;" & _
    "Persist Security Info=False;" & _
    "User Id=sa;" & _
    "Initial Catalog=TPO;" & _
    "Data Source=SLC-CUSTSQL"

    cm.ActiveConnection = cn
    cm.CommandText = ("SELECT D_Import FROM tImport")

    Set rs = cm.Execute


    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308
    Execute method is only for Action-Queries.
    Your SQL is not action type so you should use:

    rs.Open .....<the rest of parameters>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width