General information
Category:
The Mere Mortals .NET Framework
Title:
Stored Procedure concurrency
Environment versions
Network:
Windows 2003 Server
I'M looking into the business layer generator for concurrency management with stored procedure
Their's a check box in the "business layer generator" in the data section, but it is not visible. (no code....) ???
so I get an DBConcurrencyException from the sql server with update command within the stored procedure
Can be all field or a Time stamp !!! So it look like the DataSet generator
THE ACTUAL GENERATED STORE PROCEUDRE LOOK LIKE THIS:
----------------------------------------------------
CREATE PROCEDURE [Accounting].[CustomerUpdate]
(
@CustomerCreditLimit money,
@CustomerId varchar(10),
@CustomerName varchar(100)
)
AS
SET NOCOUNT OFF;
UPDATE [Accounting].[Customer]
SET
[CustomerCreditLimit] = @CustomerCreditLimit,
[CustomerId] = @CustomerId,
[CustomerName] = @CustomerName
WHERE
(
([CustomerId] = @CustomerId)
);
SELECT
[CustomerCreditLimit],
[CustomerId],
[CustomerName]
FROM [Accounting].[Customer]
WHERE
([CustomerId] = @CustomerId)
THE IDEAL GENERATED STORE PROCEUDRE:
----------------------------------------------------
CREATE PROCEDURE [Accounting].[CustomerUpdate]
(
@CustomerCreditLimit money,
@CustomerId varchar(10),
@CustomerName varchar(100),
@OldValueCustomerCreditLimit money,
@OldValueCustomerName varchar(100))
)
AS
SET NOCOUNT OFF;
UPDATE [Accounting].[Customer]
SET
[CustomerCreditLimit] = @CustomerCreditLimit,
[CustomerId] = @CustomerId,
[CustomerName] = @CustomerName
WHERE
(
([CustomerId] = @CustomerId
and [CustomerName]=@OldCustomerName
and [CustomerCreditLimit]=@OldCustomerCreditLimit)
);
SELECT
[CustomerCreditLimit],
[CustomerId],
[CustomerName],
[CustomerNewField]
FROM [Accounting].[Customer]
WHERE
([CustomerId] = @CustomerId)
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only