PDA

Click to See Complete Forum and Search --> : Primary key problem!!!!!!!!! urgent....


kandan
Nov 23rd, 1999, 11:19 AM
hi,

I've created a counter table (NextAvailID), and when someone wants to insert a record into the "main" table, I want to read the counter table (NextAvailID), increment the value by 1 and then update the counter table (NextAvailID). This will give me the next available primary ID to insert into my "main" table.

The problem is, I need SPECIFICS (like actual ADO commands) on how to read and update this "counter" table so no other user can even read this "counter" table until it is updated with the incremented value.

can any1 help me out!!!!!!!!!! its urgent...
kandan
E-mail: rg_kandan@usa.net
ICQ: 52774533

msdnexpert
Nov 23rd, 1999, 12:32 PM
Try the following be opening a recordset on the table.

MyRecordset.open "NextAvailID",connection object,adoopenkeyset,adlockpessimistic,adcmdtable