aspxtreme

Letting Users Update Information

ADO Primer


This article is the fourth of a series on how to retrieve and update information stored in databases. In this section, we look into the ADO methods to let users add, edit, and delete information in a data set.


Opening an updatable Recordset

Recall that the behavior of a Recordset is affected by how its CURSOR and LOCK properties are configured. A Recordset by default opens with a forward-only CursorType, and its LockType set to read-only.

To be able to update a Recordset, you can use any of the CursorTypes, but its LockType property must be set to other than the default. You can do this either before opening the Recordset object, for example

recordset.CursorType=1
recordset.LockType=3

or can be passed as arguments in the recordSet.Open method call.

recordset.Open "tableName", connectionObj, 1, 3, 2

Alternatively, if you use the ADO constants include file, you can use

recordset.Open "tableName", connectionObj,
   adOpenKeyset, adLockOptimistic, adCmdTable

For these exercises, we shall be using a Recordset that is opened with either a keyset or dynamic cursor and employs optimistic locking.



Books and more ...


Suggested Reading

Need a break ?


More ...
Back to top

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support aspxtreme