Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: CursorLocation


Message #1 by "Jens Nilsson" <jens_nilson@h...> on Fri, 17 Nov 2000 12:58:26 CET
Hello

I would be very glad if someone could explain the Recordset.CursorLocation 

for me. I understand that the server-cursor will be static, and the client 

can be dynamic. But:



- What is a disconnected Recordset, is it imposible to update that one?

- If I want to use a clientside cursor, how do I make it updateable? Can I 

only do Recordset updates with Rs.Update or is it possible to do it with 

SQL-commands?

- If I only want to list some data from my database, what's the best 

CursorLocation?



Thank you very much, regards Jens.



Message #2 by "Toby Anscombe" <tanscombe@m...> on Fri, 17 Nov 2000 13:50:27 -0000
Jens

Here is a list of cursor types (you can find all this and more on MSDN)



Constant 			Value 			Description

adOpenDynamic 		2 				Uses a dynamic cursor. Additions, changes, and

deletions by other users are visible, and all types of 								movement

through the Recordset are allowed, except for 								bookmarks, if the

provider doesn't support them.



adOpenForwardOnly		 0 				Default. Uses a forward-only cursor. Identical to

a 									static cursor, except that you can only scroll forward

through records. This improves performance when you 									need to make

only one pass through a Recordset.



adOpenKeyset 		1 				Uses a keyset cursor. Like a dynamic cursor, except

that you can't see records that other users add, 									although records

that other users delete are 										inaccessible from your Recordset. Data

changes by 									other users are still visible.



adOpenStatic 		3 				Uses a static cursor. A static copy of a set of

records that you can use to find data or generate 									reports.

Additions, changes, or deletions by other 									users are not visible.



adOpenUnspecified 	-1 				Does not specify the type of cursor.





I *think* what you want to do is this

<Proc>

Dim rs As New ADODB.Recordset

Dim cmd As ADODB.Command

Dim strStoredProcName As String



rs.CursorLocation = adUseClient

rs.LockType = adLockBatchOptimistic



strStoredProcName = "your sp name"



Set cmd = Get_sp_Enabled_Command(strStoredProcName, DebugMode) // gets an

active connection



cmd.Parameters("@Var1") = Var1

cmd.Parameters("@var2") = Var2



Set rs = cmd.Execute



Set cmd.ActiveConnection = Nothing



Set rs.ActiveConnection = Nothing



return rs

</Proc>



rs is now a disconnected clientside rs so you can navigate / update / addnew

/ delete

to update again

<Proc>

Set cmd = Get_sp_Enabled_Command(strStoredProcName, DebugMode) // gets an

active connection

//Get a new active connection



set rs.activeconnection = cmd



rs.UpdateBatch

</Proc>







Does this kinda make sense ??



-----Original Message-----

From: Jens Nilsson [mailto:jens_nilson@h...]

Sent: 17 November 2000 20:38

To: ASP Databases

Subject: [asp_databases] CursorLocation





Hello

I would be very glad if someone could explain the Recordset.CursorLocation

for me. I understand that the server-cursor will be static, and the client

can be dynamic. But:



- What is a disconnected Recordset, is it imposible to update that one?

- If I want to use a clientside cursor, how do I make it updateable? Can I

only do Recordset updates with Rs.Update or is it possible to do it with

SQL-commands?

- If I only want to list some data from my database, what's the best

CursorLocation?



Thank you very much, regards Jens.




  Return to Index