ASP cursor parameters detailed (ASP Recordset) 1th/2 page _ Application Tips

Source: Internet
Author: User
Tags microsoft sql server odbc
Rs.Open sql,conn,a,b


A:


adOpenForwardOnly (=0)


Read-only, and the current data record can only move down.


adOpenKeyset (=1)


Read-only and the current data record is free to move.


adOpenDynamic (=2)


Can read and write, the current data record can be moved freely.


adOpenStatic (=3)


Can read and write, the current data record can be moved freely, you can see the new record.


B:


adLockReadOnly (=1)


The default lock type, the recordset is read-only, and the record cannot be modified.


adLockPessimistic (=2)


Pessimistic locking, when a record is modified, the data provider attempts to lock the record to ensure that the record is successfully edited, and the record is locked as soon as the editor begins.


Adlockoptimitic (=3)


Optimistic locking is not locked until the updated record is submitted with the Update method.


adLockBatchOptimistic (=4)


Bulk optimistic locking allows multiple records to be modified, and records are locked only when the update batch method is invoked.


When you do not need to change any records, you should use a read-only recordset so that the provider does not have to do any testing. For general use, optimistic locking may be the best option because the record is only locked for a short period of time and the data is updated during this time period. This reduces the use of resources.





You can use the Recordset object to manipulate data from the provider. With ADO, almost all data can be manipulated through a Recordset object. All Recordset objects are constructed using records (rows) and fields (columns). Some Recordset methods or properties may not be valid because the functionality supported by the provider is different.


There are four different types of cursors defined in ADO:


Dynamic cursors? Used to view additions, changes, and deletions made by other users, and for various types of movement in a bookmark-independent Recordset. Bookmarks can be used if the provider supports them.


Key set cursor? It behaves like a dynamic cursor, except that it prevents viewing of records added by other users and prevents access to records deleted by other users, and changes to data made by other users will remain visible. It always supports bookmarks, so it allows various types of movement in the Recordset.


Static cursors? Provides a static copy of a record collection to find data or generate a report. It always supports bookmarks, so it allows various types of movement in the Recordset. Additions, changes, or deletions made by other users will not be visible. This is the only cursor type that is allowed when the client (ADOR) Recordset object is opened.


Forward-only cursors? In addition to allowing only scrolling forward in a record, its behavior resembles a static cursor. This can improve performance when you need to move one way in the Recordset.


Set the CursorType property to select the cursor type before opening the Recordset, or use the open method to pass the CursorType parameter. All cursor types are not supported by partial providers. Please check the documentation for the provider. If you do not specify a cursor type, ADO opens the forward-only cursor by default.


If the recordset is opened after the CursorLocation property is set to adUseClient, the UnderlyingValue property of the Field object is not available in the returned Recordset object. For some providers (for example, Microsoft ODBC Provider for OLE DB, along with Microsoft SQL Server), you can pass the connection string by using the Open method, creating the Rec independently of the previously defined Connection object Ordset object. ADO still creates the Connection object, but it does not assign the object to an object variable. However, if you are opening multiple Recordset objects on the same connection, you should explicitly create and open the Connection object, which assigns the Connection object to the object variable. If you do not use the object variable when you open the Recordset object, ADO creates a new Connection object for each new recordset, even if you pass the same connection string.


You can create the desired number of Recordset objects.


When the recordset is opened, the current record is in the first record (if any), and the BOF and EOF properties are set to False. If there are no records, the BOF and EOF property settings are True.


Assuming that the provider supports related functionality, you can use the MoveFirst, MoveLast, MoveNext, and MovePrevious methods, as well as the Move method, and the AbsolutePosition, AbsolutePage, and Filter property to redefine the location of the current record. Only the forward Recordset object supports the MoveNext method only. When you use the Move method to access each record (or enumerate the recordset), you can use the BOF and EOF properties to see if the movement has exceeded the start or end of the recordset.


A Recordset object can support two types of updates: Immediate and batch updates. With immediate updating, once the Update method is called, all changes to the data are immediately written to the underlying data source. You can also use the AddNew and update methods to pass an array of values as parameters, while updating several fields of a record.


If the provider supports batch updates, you can enable the provider to cache changes to multiple records and then use the UpdateBatch method to route them to the database in a single call. This applies to changes made using the AddNew, Update, and Delete methods. After calling the UpdateBatch method, you can use the Status property to check for any data conflicts and resolve them.


Note To execute a query that does not use the Command object, you should pass the query string to the Open method of the Recordset object. However, you still need a command object when you want to keep the text of the command and repeat it or use query parameters.


AddNew creates a new record of updatable Recordset objects.


Append appends the object to the collection. If the collection is Fields, you can first create a new Field object and then append it to the collection.


AppendChunk appends data to large text, binary data Field, or Parameter objects.


BeginTrans, CommitTrans, and RollbackTrans manage the transaction processes in the Connection object as follows:


BeginTrans? Start a new transaction.


CommitTrans? Save any changes and end the current transaction. It may also start a new transaction.


RollbackTrans? Cancels any changes made in the current transaction and ends the transaction. It may also start a new transaction.


Cancel cancels execution of a pending, asynchronous execute, or Open method call.


Cancel (RDS) cancels an asynchronous execution or fetch that is currently running.


CancelBatch cancels the pending batch update.


CancelUpdate cancels any changes to the current record or new record before calling the Update method.


CancelUpdate (RDS) discards all pending changes associated with the specified Recordset object, restoring the value after the last call to the Refresh method.


Clear deletes all objects in the collection.


Clone creates the same replication Recordset object as an existing Recordset object. Optionally specify that the copy is read-only.


Close closes the open object and any related objects.


CompareBookmarks compares two bookmarks and returns a description of their difference values.


ConvertToString converts a Recordset to a MIME string that represents recordset data.


CreateObject (RDS) creates a proxy for the target business object and returns a pointer to it.


CreateParameter creates a new Parameter object using the specified property.


CreateRecordset (RDS) creates an empty, disconnected Recordset.


Delete (ADO Parameters Collection) Deletes an object from the Parameters collection.


Delete (ADO Fields Collection) Deletes an object from the Fields collection.


Delete (ADO Recordset) deletes the current record or group of records.


Execute (ADO Command) executes the query, SQL statement, or stored procedure specified in the CommandText property.


Execute (ADO Connection) executes the specified query, SQL statement, stored procedure, or text of a specific provider.


Find searches the recordset for records that meet the specified criteria.


GetChunk returns all or part of a large text or binary data Field object.


GetRows restores multiple records of a Recordset object to an array.


GetString returns the Recordset as a string.


Item returns a specific member of a collection based on its name or ordinal.


Move moves the position of the current record in the Recordset object.


MoveFirst, MoveLast, MoveNext, and MovePrevious move to the first, last, next, or previous record in the specified Recordset object and make the record the current record.


MoveFirst, MoveLast, MoveNext, MovePrevious (RDS) move to the first, last, next, or previous record in the displayed recordset.


NextRecordset clears the current Recordset object and returns the next recordset through the advance command sequence.


Open (ADO Connection) opens a connection to the data source.


Open (ADO Recordset) opens the cursor.


OpenSchema Gets the database schema information from the provider.


Query (RDS) returns the Recordset using a valid SQL query string.


Refresh updates the objects in the collection to reflect the available objects from the provider and the provider-specific objects.


Refresh (RDS) queries the ODBC data source specified in the Connect property and updates the query results.


Requery updates the data in the Recordset object by performing a rerun of the query on which the object is based.


Reset (RDS) performs sorting or filtering on the client Recordset based on the specified sorting and filtering properties.


Resync refreshes the data in the current Recordset object from the base database.


The Save (ADO Recordset) saves (persisted) the recordset in a file.


Seek searches the index of the Recordset to quickly locate the row that matches the specified value and change the position of the current row to that row.


SubmitChanges (RDS) submits pending changes to the locally cached updatable Recordset to the ODBC data source specified in the Connect property.


Supports determines whether the specified Recordset object supports specific types of functionality.


Update saves all changes to the current record of the Recordset object.


UpdateBatch writes all pending batch updates to the disk.


Current 1/2 page 12 Next read the full text
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.