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.
| Author |
Topic |
|
sqlmom
Starting Member
5 Posts |
Posted - 2003-06-05 : 12:25:01
|
| 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. |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-06-05 : 12:49:33
|
| Questions 1,2,3 & 4: Its best that you do not use the ADO recordsets to update data. Use stored procedures, they are faster, (a lot) less prone to locking problems and secure.Creating disconnected recordsets is easy:Dim cnn as new ADODB.ConnectionDim rs as new ADODB.Recordsetcnn.ConnectionString = "blah"cnn.Openrs.CursorLocation = adUseClientrs.Open "SQL Select String here", cnn, adOpenSnapshot, adLockReadOnlyset rs.ActiveConnection = NothingYou can use the recordset for as long as you want. Since you will not be doing any updates, you can set the locking behaviour to adLockReadOnly. And client side cursors cannot be forward-only, they are always scrollable. So you can safely use adOpenSnapshot.OwaisEdited by - mohdowais on 06/05/2003 12:50:21 |
 |
|
|
biswajitdas
Starting Member
44 Posts |
Posted - 2003-06-12 : 03:41:35
|
quote: Questions 1,2,3 & 4: Its best that you do not use the ADO recordsets to update data. Use stored procedures, they are faster, (a lot) less prone to locking problems and secure.Creating disconnected recordsets is easy:Dim cnn as new ADODB.ConnectionDim rs as new ADODB.Recordsetcnn.ConnectionString = "blah"cnn.Openrs.CursorLocation = adUseClientrs.Open "SQL Select String here", cnn, adOpenSnapshot, adLockReadOnlyset rs.ActiveConnection = NothingYou can use the recordset for as long as you want. Since you will not be doing any updates, you can set the locking behaviour to adLockReadOnly. And client side cursors cannot be forward-only, they are always scrollable. So you can safely use adOpenSnapshot.OwaisEdited by - mohdowais on 06/05/2003 12:50:21
hi i want do everything in sqli want make it in my tips |
 |
|
|
biswajitdas
Starting Member
44 Posts |
Posted - 2003-06-12 : 03:44:44
|
| hi i am das.i gone through your question.would you elaborate the question.dissconeted recordset is faster and alway u use client side cursor in that casehi i want do everything in sqli want make it in my tips |
 |
|
|
|
|
|
|
|