U r doing it OK username.
adLockOptmistic and adOpenStatic. This is sufficient in most of the situations. u may consider adOpenKeySet also if u want to see records changed by other users.
Quote:
Originally Posted by robbedaya
i use adOpenDynamic and adLockPessimistic to write data to the database, the data is editable and is the record locked properly so the date kan not be altered by a third party while you're editing.
we should avoid dynamic recordsets and pessimistic locking where ever possible.
I think u are wrong here. Pessimistic locking means locking the whole table when updating it. Optimistic locking locks only the current row.
Quote:
Originally Posted by robbedaya
When inserting you don't need to load the whole recordset (if your table contains thousands of records it would take a lot of time) so i took the top 1 the only one record is loaded.
Normally i do it like this
"SELECT * FROM table Where ID_column=0" (if the id_column never contains 0, so no records are loaded when inserting.)
I too prefer this method. But a bettter method to open empty recordsets is to avoid any field name in where clause like this:
SELECT * FROM TableName WHERE 0=1
This will always return an empty recordset.
Pradeep :)