Y
yyt
Hi
I read through quite a few news postings and articles related to the
Concurrency issues in ado.net. .. But didn't get the concept and hence has
not solved my problem.
I have a asp.net app. where user submits a form to the database. The
asp.net appl. calls a SQL2K stored procedure to perform the db update. -
Inside the SP, I check if any record exists for the form Sr. #. if not, then
insert a new record otherwise update the record for the form #. The table
had a Unique Identity column as the primary key. The sql to check for
unique record looks something like this:
DECLARE @RECID INT
select @RECID = Form_ID from FormData where Form_SrNum = @Form_SrNum
set @RECID = ISNULL(@RECID,0)
if @RECID = 0
BEGIN
/* Insert new record here */
END
else
BEGIN
/* Update the record */
END
The Inserts /Updates work fine in a single-user case. However, if 2 users
happen to submit a new form at the same time then the changes made by user 1
get overwritten by user 2.
How can I need to avoid the concurrency? Do I need to modify the SP or the
asp.net .vb class?
Appreciate any help.
I read through quite a few news postings and articles related to the
Concurrency issues in ado.net. .. But didn't get the concept and hence has
not solved my problem.
I have a asp.net app. where user submits a form to the database. The
asp.net appl. calls a SQL2K stored procedure to perform the db update. -
Inside the SP, I check if any record exists for the form Sr. #. if not, then
insert a new record otherwise update the record for the form #. The table
had a Unique Identity column as the primary key. The sql to check for
unique record looks something like this:
DECLARE @RECID INT
select @RECID = Form_ID from FormData where Form_SrNum = @Form_SrNum
set @RECID = ISNULL(@RECID,0)
if @RECID = 0
BEGIN
/* Insert new record here */
END
else
BEGIN
/* Update the record */
END
The Inserts /Updates work fine in a single-user case. However, if 2 users
happen to submit a new form at the same time then the changes made by user 1
get overwritten by user 2.
How can I need to avoid the concurrency? Do I need to modify the SP or the
asp.net .vb class?
Appreciate any help.