Results 1 to 6 of 6

Thread: Disconnected Recordsets in ADO?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Question

    I am having trouble creating a disconnected recordset with ADO. The information I have seems to be incomplete. I open a connection, create a recordset, and when I try to use the ActiveConnection = Nothing it tells me that I can't as long as the database is open, but if I close the connection, it also gives me an error. Can someone help?

    Thanks!

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Wink

    post your code so the gurus here can have a look

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Unhappy

    Here is the code that I have:



    Set cnSQL = New ADODB.Connection
    Set rstClaims = New ADODB.Recordset

    With cnSQL
    .ConnectionString = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & xpath & "Spmedbk.mdb"
    End With

    cnSQL.Open

    rstClaims.CursorType = adOpenStatic
    rstClaims.Open "Select * FROM IN93010A", cnSQL, , adLockBatchOptimistic

    Set rstClaims.ActiveConnection = Nothing
    cnSQL.Close


    Any help that you all can give me would be greatly appreciated. I am trying to connect to an Access Database that is on my computer (the path is xpath obviously).


  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    For recordset usage, the activeconnection property can be changed until you open the recordset, at which point it becomes read-only.

  5. #5
    Hyperactive Member compuGEEK's Avatar
    Join Date
    May 1999
    Location
    Mpls,MN,USA
    Posts
    281
    Code:
    rstClaims.Open "Select * FROM IN93010A", cnSQL, , adLockBatchOptimistic
    Try this:
    Code:
    dim rstClaims as New ADODB.Recordset
    
    with rstClaims
         .ActiveConnection = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & xpath & "Spmedbk.mdb"
         .CursorLocation = asOpenStatic
         .LockType = adLockBatchOptimistic
         .Source =  "Select * FROM IN93010A"
         .Open
    end with
    This should make closing everything easier:
    Code:
         Set adoRS.ActiveConnection = Nothing

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Talking

    Thanks compuGEEK!! It worked like a charm!!!!!!

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