hi to all,
i develped an application with C# and Sql server2000. in that application, it will gets the maximum of Id from the Table and inserts a new record with maximum of ID+1. this function will be called by many threads.this leads to collision when two threads called the function at same time. so both thread will get the same Id. in order to avoid this i need to lock the table before selceting the maximum value of ID from Table. i dont know how to lock that table.Thanks in Advance.
i develped an application with C# and Sql server2000. in that application, it will gets the maximum of Id from the Table and inserts a new record with maximum of ID+1. this function will be called by many threads.this leads to collision when two threads called the function at same time. so both thread will get the same Id. in order to avoid this i need to lock the table before selceting the maximum value of ID from Table. i dont know how to lock that table.Thanks in Advance.
Comment