Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preferred Cursor Location?

Status
Not open for further replies.

riarc

Programmer
Dec 6, 2001
44
US
I am contecting to SQL server 2000. Which is the preferred location for my cursor? client or server? I am trying to get a recordcount and I keep getting a -1. Can anybody offer any suggestions.
riarc
 
hie,
I have your answer.

First of all about cursor Locations.


Cursor location to adUseServer (server) is set
when one wants to retrieve data using a forward-only
cursorType which uses least resources as compare to
other CursorTypes. Advantage of using server-side
cursor location is mainly with forward-only cursorType
because this will minimize resource usage on server
as well as, Network Trafic can be minimized too.

Cursor location is set to adUseClient when
recordset is expected to use significant resources
which may prove very costly on server. Also,
CursorType with client-side cursors usually allow
insertion/modification/deletion of records also
sorting and searching are common tasks with
client-side cursors, Which uses more resources but
network usage can significantly decrease because there
will be no communication with server for searching as
well as adding records in recdordset. Only when u issue
update statement, your communicatin wiil start with
server.

Simply :

Server-side cursors are used to minimize/avoid
network trafic. Forward-only cursorType is recommended
for server-side cursors.

client-side cursors are used to minimize resources
on server. Beware too much communication with server may
turn this crusor location your biggest nightmare (because
of network trafic).


As far as RecordCount property is concerned no approximate
positioning is supproted by forward-only cursor. use
static or keyset which will surely support approximate
positioning which is vital for RecordCount property. For
dynamic cursoryType Data Source will decide wether
approximate positioning is supported if, it is then u
can use RecordCount property otherwise not.

remember -1 indicates "No Information Available"

I hope this is not a heavy dose!

bye





 
That's everything I needed to know. Thank you very much.
 
Hi,

in addition to what has been presented above I would like to add a few things:

1. Client-Side servers can be disconnected from the connection. This reduces the strain on the serve and frees up connections in the connection pool, while still allowing the application to manipulate the data.

2. When retrieiving a large recordset but actually only working with a small subset, Microsoft advises using a server side cursor.


James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
hi,
Make habit of appreciating others work (if u like)
by
(1) Thanking them in a response (Which you did)

(2) Mark post for being helpfull (you didn't)

This gives new energy and great feeling of appricition
by others.


bye :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top