Click here to Skip to main content
16,008,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good morning all,
my app working with a table with one record in it. The record is used to keep the next available unique id. The way the system is developed, to get the next id you lock the table, create a new record with the id incremented by 1. Then delete the old record and unlock the table.

I can not figure out how to lock a table with using linq to sql and see a way to both get the id and update the record in one statement so the locking is done for me.

I need to find a way to get the ID and increment it and be sure no one else managed to get the ID also before i increment it.
Posted

1 solution

LinQ to SQL supports concurrency in all sorts of ways. Your best bet is to go through some of the articles on MSDN. This How to: Manage Change Conflicts(LinQ to SQL)[^] is a good place to start.

Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900