string strSQL; // With SQL Server, you can issue the following query to lock a row of // data in a transaction, regardless of the transaction’s isolation level strSQL = "SELECT CustomerID, CompanyName FROM Customers " + "WITH (UPDLOCK) WHERE CustomerID = 'ALFKI'"; SqlConnection cn = new OleDbConnection(strConn); cn.Open(); SqlTransaction txn = cn.BeginTransaction(); SqlCommand cmd = new SqlCommand(strSQL, cn, txn); SqlDataAdapter da = new SqlDataAdapter(cmd); // Create command statements ... DataTable tbl = new DataTable(); da.Fill(tbl); DataRow row = tbl.Rows[0]; row["CompanyName"] = "Modified"; da.Update(tbl); txn.Rollback(); cn.Close();>Hello all, I use a table to keep track of my primary keys. Basically the table contains a field for the tablename and a field for the next available primary key. Is there a way to lock the sql server record until I update it? Also can I run a loop checking the status of the lock so I can grab another lock as soon as the first lock is complete? Thanks for the help.