Below is an example of how to lock a record for update operation
strCmd = "select serial_num from DBase..Table with (UPDLOCK) where mobile_num = '' order by serial_num asc";
cmd.CommandText = strCmd;
reader = cmd.ExecuteReader();
if (reader.Read() == true)
{
strResult = reader.GetString(0);
}
reader.Close();
// update content of the record
strCmd = "update DBase..Table set mobile_num='" + strMobile + "', create_timestamp='" + strPresTime + "', SID='" + strSID + "' where serial_num='" + strResult + "'";
cmd.CommandText = strCmd;
cmd.ExecuteNonQuery();
Thursday, November 26, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment