Data | database | Cursors Generally speaking, the following is a typical process for opening a database.
<%
' Cursor type
Const adopenforwardonly = 0
Const adOpenKeyset = 1
Const adopendynamic = 2
Const adOpenStatic = 3
' Lock type
Const adLockReadOnly = 1
Const adlockpessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
%>
<% Set Conn = Server.CreateObject (' ADODB. Connection ')%>
<% Set Rsmov = Server.CreateObject (' ADODB. RecordSet ')%>
<% Conn.Open ' Soc ', ', '%>
<% Rsmov.open Sqlmov, Conn, adOpenKeyset, adLockReadOnly%>
Cursors are more flexible when used, and are sometimes used to describe a recordset, sometimes a pointer to a record in the current Recordset. Cursors are primarily used to establish a SQL-accessible access grid for row/column relationships in a relational database. Technical terms that are related to cursors there is also a name for the bookmark. If you choose a cursor way to support bookmarks. The database will provide powerful functionality for the number of records. In so many cursor ways written above, adopendynamic is not very useful, although it provides the ability to display all of the update operations of records in a database in real time, but because not all databases support the cursor method, A cursor without portability is not very useful for the current complex database. In the actual programming, I believe that we use the most frequently is the adopenstatic way, of course, the disadvantage of this way is not able to, real-time response to the contents of the database changes in the situation. If you want to see a situation where the database has been changed by another user, you can use the Adopenkeyse method (but it can only reflect changes that are edited, that is, you can't show changes to the new and deleted records.) )
In fact, the above content can generally be found in Microsoft technical resources, the following is said in the use of these cursors
Mode and lock the way to note the problem.
1. The first thing to notice is the problem of mixing the two methods, which means that you set both the cursor and the lock.
Unless you are using an Access database, generally when you are mixing it is not possible to get the cursor and lock mode you expect. For example, if you set the cursor to adopenstatic at the same time, and the lock is set to adLockOptimistic, you will not get a cursor in the adOpenStatic way, and the way you use the cursor will be
adOpenKeyset, which means that you use ADO, it will return the adOpenKeyset cursor.
2. Second, the combination of cursor and lock will also cause ADO to return not the way you want to add locks, ADO will change your lock
Way. For example, the downstream subscript in the default state is adOpenForwardOnly, while using this cursor method, if
The way you use the lock-1 (which is to have the data source to judge the lock mode) or adLockReadOnly, then this blending mode basically does not support any method of the recordset, which means that any method of the recordset will return False
(Your recordcount,absoultpage,addnew,delete,update and so on will return -1,-1 means that the attribute is not supported) But then if you're using a adopenforwardonly cursor that mixes with other locking methods, it will instead support filling, deleting, and updating.