Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Old Forums
 CLOSED - General SQL Server
 disconnected recordsets

Author  Topic 

sqlmom
Starting Member

5 Posts

Posted - 2003-06-05 : 12:37:17
(accidently posted this in wrong forum, sorry)
I'm learning to create and use disconnected recordsets with ADO in VB6 and see how nifty it is, but I want to understand the implications and possible drawbacks. Can anyone answer these questions?

1) If I only want to use the data in the recset, but not change it, is there a preferred way to get it (and still be disconnected)?

2) Must you always use: adUseClient, adOpenForwardOnly, adLockBatchOptimistic?

3) If you use adUseClient, adOpenForwardOnly, adLockBatchOptimistic, and you don't update the recordset, is that bad?

Now those were all pretty much the same question, but how about this:

4) I have a disconnected recset which is the result of a join from 2 tables. I want to add a record to the recset but only want to effect 1 table. Is there a way either via ADO or by way of sql table/column config?

Thanks anyone out there who can help.



chadmat
The Chadinator

1974 Posts

Posted - 2003-06-05 : 12:52:10
You shouldn't cross post.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=26799

-Chad

http://www.clrsoft.com

Software built for the Common Language Runtime.
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-06-05 : 12:52:37
Cross post!!
http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=26799

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-06-05 : 12:54:45
I think this is the prefered way of doing disconected recordsets:


With Rs
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
End With

rs.Open AdoCommandObject
rs.Activeconnection = nothing

'something like that



As far as updating, do not do RS.Update. With a disconnected recordset, I'm pretty sure you can't. Whenever you want to insert / update the recordset, use a stored proc to put the data into the database. I believe that you can "add" the record to the disconnected recordset as well, but do not use the RS to do the update.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

Doug G
Constraint Violating Yak Guru

331 Posts

Posted - 2003-06-06 : 04:45:27
You can reattach your disconnected recordset to an open connection and then do an rs.update.

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q184/3/97.asp&NoWebContent=1


======
Doug G
======
Go to Top of Page
   

- Advertisement -