J
Jay Pondy
VS2008 / SQL Server 2005 / Windows XP
I have been unable to generate a concurrency exception using a single table
in a DataContext.dbml with Insert / Update / Delete SPs via a LINQDataSource
and a FormView.
I am able to successfully add, update and delete rows but not generate a
concurrency exception.
After two days I'm feeling pretty darned stumped!! I can bundle the whole
thing up if anybody is up for taking a look.
Here is the SQL I am using:
CREATE TABLE [dbo].[Departments](
[PKID] [int] IDENTITY(1,1) NOT NULL,
I have been unable to generate a concurrency exception using a single table
in a DataContext.dbml with Insert / Update / Delete SPs via a LINQDataSource
and a FormView.
I am able to successfully add, update and delete rows but not generate a
concurrency exception.
After two days I'm feeling pretty darned stumped!! I can bundle the whole
thing up if anybody is up for taking a look.
Here is the SQL I am using:
CREATE TABLE [dbo].[Departments](
[PKID] [int] IDENTITY(1,1) NOT NULL,
Code:
[varchar](10) NOT NULL,
[Description] [varchar](50) NOT NULL,
[TS] [timestamp] NOT NULL,
CONSTRAINT [PK_Departments] PRIMARY KEY CLUSTERED
(
[PKID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
CREATE PROCEDURE [dbo].[zDepartmentInsert]
@PKID INT OUTPUT,
@Code VARCHAR(10),
@Description VARCHAR(50),
@TS TIMESTAMP OUTPUT
AS
INSERT INTO [dbo].[Departments] (
[Code],
[Description]
) VALUES (
@Code,
@Description)
SELECT
@PKID = SCOPE_IDENTITY(),
@TS = TS
FROM [dbo].[Departments]
WHERE
[PKID] = SCOPE_IDENTITY()
GO
CREATE PROCEDURE [dbo].[zDepartmentUpdate]
@PKID int,
@Code varchar(10),
@Description varchar(50),
@TS timestamp OUTPUT
AS
UPDATE [dbo].[Departments] SET
[Code] = @Code,
[Description] = @Description
WHERE
[PKID] = @PKID AND
[TS] = @TS
SELECT
@TS = [TS]
FROM [dbo].[Departments]
WHERE
[PKID] = @PKID
GO
CREATE PROCEDURE [dbo].[zDepartmentDelete]
@PKID int,
@TS timestamp
AS
DELETE FROM
[dbo].[Departments]
WHERE
[PKID] = @PKID AND
[TS] = @TS
GO