PDA

Click to See Complete Forum and Search --> : Disconnected Recordsets in ADO?


jws1414
Aug 1st, 2000, 11:09 AM
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!

DrewDog_21
Aug 1st, 2000, 12:23 PM
post your code so the gurus here can have a look

jws1414
Aug 1st, 2000, 01:12 PM
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).

JHausmann
Aug 1st, 2000, 01:38 PM
For recordset usage, the activeconnection property can be changed until you open the recordset, at which point it becomes read-only.

compuGEEK
Aug 1st, 2000, 03:13 PM
rstClaims.Open "Select * FROM IN93010A", cnSQL, , adLockBatchOptimistic


Try this:


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:

Set adoRS.ActiveConnection = Nothing

jws1414
Aug 2nd, 2000, 09:56 AM
Thanks compuGEEK!! It worked like a charm!!!!!!