Først ikkepædagogisk: If the CursorLocation property is set to adUseClient, the recordset will be accessible as read-only, and recordset updates to the host are not possible. When the CursorLocation property is set to adUseClient (use the client cursor engine), the Find method, Filter property, and Sort property will work if MDAC 2.0 or higher is installed, but will not work properly with earlier versions of ADO.
Fra MSDN Lobraries... The CursorLocation property on a Connection object or Recordset object indicates the location of the cursor engine. This property sets or returns a Long value representing a CursorLocationEnum.
Remarks The CursorLocation property is used to set or return the location of the cursor. This property can be set to one of the following CursorLocationEnum constants:
Enumeration Value Description adUseNone 1 This value indicates no cursor location. This value is not supported by the OLE DB Provider for AS/400 and VSAM. adUseServer 2 This value indicates that the data provider or driver-supplied cursor is used. adUseClient 3 This value indicates that a client-side cursor supplied by a local cursor library is to be used. adUseClientBatch 3 For backward compatibility, this value indicates that a client-side cursor supplied by a local cursor library is to be used.
This property setting only affects connections established after the property has been set. Changing the CursorLocation property has no effect on existing connections.
This property is read/write on a Connection object or a closed Recordset, object and read-only on an open Recordset.
If the CursorLocation property is set to adUseClient, the recordset will be accessible as read-only, and recordset updates to the host are not possible. When the CursorLocation property is set to adUseClient (use the client cursor engine), the Find method, Filter property, and Sort property will work if MDAC 2.0 or higher is installed, but will not work properly with earlier versions of ADO.
Skal jeg forstå det således, at når jeg blot har brug for at læse fra databasen skal jeg bruge adUseClient, men når jeg skal skrive til databasen skal jeg bruge adUseServer ???
Ja, hvis du ikke lukker dine recordsets samt connections. At sætte dem til nothing er i princippet en god programmeringsskik. IIS rydder selv op efter sig, men gør det alligevel.
MSDN : Specifying the Cursor Location ADO also supports two kinds of cursor engines: the server cursor engine and the client cursor engine. The location of the cursor engine determines certain aspects of the functionality of ADO Recordset objects.
To specify which cursor engine to use, you use the CursorLocation property of the Recordset or Connection object. Set the CursorLocation property to adUseServer to use the server cursor engine, and to adUseClient to use the client cursor engine. To specify the cursor engine for a Recordset object, you must set the CursorLocation property before opening the Recordset object. If you set the CursorLocation property of a Connection object, any Recordset object you open while using that Connection object will inherit that connection\'s setting. By default, when opening a Connection object for an Access database, the CursorLocation property is adUseServer.
To determine which cursor engine to use — client or server — you should know the following:
The server cursor engine is provided by the OLE DB provider and the database engine itself, which for Access databases means the Microsoft Jet 4.0 OLE DB Provider and the Microsoft Jet database engine. For SQL Server databases it means the Microsoft SQL Server OLE DB Provider and either SQL Server or the Microsoft Data Engine (MSDE). In both cases, the database engine builds a set of keys, called a keyset, which is stored locally for Access databases and on the server for SQL Server databases. The database engine then uses the keyset to retrieve and scroll through the records in the database.
The client cursor engine is an OLE DB service component that buffers and copies the specified records to a temporary table that is stored locally in memory, or on disk, if the number of records is sufficiently large. If you make changes to field data, or call the AddNew or Delete method on a client-side cursor, ADO automatically generates the appropriate SQL UPDATE, INSERT, and DELETE statements and sends them to the database engine when you update the Recordset object. A cursor generated by the server cursor engine is often called a server-side cursor, and a cursor generated by the client cursor engine is called a client-side cursor. The differences between them are as follows:
The features provided by server-side cursors are specific to the database engine and OLE DB provider you are using. For Access databases, a Recordset object that uses a server-side cursor is generally more likely to be updatable than a client-side cursor, and when the database is shared by multiple users, a server-side cursor can show changes made by other users.
You can think of a client-side cursor as an updatable snapshot. By specifying the adBatchOptimistic constant for the LockType argument of the Open method of a Recordset object that is using a client-side cursor, you can use the UpdateBatch method to send updates to the database as a batch. Because the client cursor engine is an OLE DB service provider, the features provided by client-side cursors are fairly consistent across all data sources and OLE DB providers. As a general rule, you should use server-side cursors for working with Access databases, and client-side cursors when working with SQL Server databases. However, although using client-side cursors with Access databases generates additional overhead to cache records and doesn\'t expose all of the functionality of the Jet database engine, you still may want to use client-side cursors with Access databases if you are working with a remote database, or if you need to ensure uniformity of behavior when working with multiple data sources.
Kan du ikke svare. Det er sådan set dit svar der hjalp mig til at forstå min problemstilling - derfor fortjener du også nogle points...
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.