f*****e 发帖数: 5177 | 1 Here is the table:
Col1, Seqno, ...
A, 1, ...
A, 2, ...
A, 3, ...
B, 1, ...
C, 1, ...
(Col1 + seqno) is the primary key.
When I use LINQ to insert a new record, I need to calculate next seqno. For
example, if I want to insert a new row with value A in col1, the seqno will
be 4.
It is not hard to do the calculation. But the problem is that I need to lock
the table when I do that since i don't want another connection to get the
same seqno. Is there a way to do that? | c**e 发帖数: 2558 | 2 read section "Handling concurrency" in book 《LINQ in Action》
For
will
lock
【在 f*****e 的大作中提到】 : Here is the table: : Col1, Seqno, ... : A, 1, ... : A, 2, ... : A, 3, ... : B, 1, ... : C, 1, ... : (Col1 + seqno) is the primary key. : When I use LINQ to insert a new record, I need to calculate next seqno. For : example, if I want to insert a new row with value A in col1, the seqno will
|
|