本文介绍了独特的键声音错误....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
请任何人帮助我...
我收到此错误。我正在开发一个Windows应用程序当我上传文件
第一次上传完美但当我上传同一个文件时上传失败并抛出我这个例外:
Hi all
Please can anyone help me...
I am getting this error.I am working on a windows application and when I am uploading the file
first time it uploads perfectly but when I upload the same file the upload fails and throws me this exception:
"
"Violation of UNIQUE KEY constraint 'UniqueVisit'.
Cannot insert duplicate key in object 'dbo.Visit\r\nThe statement has been terminated.
\r\nThe 'Visit_Insert'
procedure attempted to return a status of NULL, which is not allow...
请允许任何人就此问题向我提出建议但我无法解决问题。
这是我的桌子
Please can anyone advice me on this I tried but not able to fix the issue.
Here is my table
CREATE TABLE [dbo].[Visit](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[VerId] [bigint] NULL,
[ClientId] [bigint] NOT NULL,
[VisitDate] [datetime] NOT NULL,
[VisitId] [char](10) NULL,
[Child] [nvarchar](50) NULL,
[CurrentMeth] [nvarchar](50) NULL,
[FollUp] [nvarchar](50) NULL,
[GestAge] [nvarchar](50) NULL,
[MedicalRef] [nvarchar](50) NULL,
[Sensitive] [nvarchar](50) NULL,
[MarketingRef] [nvarchar](50) NULL,
[Category] [nvarchar](50) NULL,
CONSTRAINT [aaclientTransaction_PK] PRIMARY KEY NONCLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [UniqueVisit] UNIQUE NONCLUSTERED
(
[ClientId] ASC,
[VisitId] 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
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Visit] WITH NOCHECK ADD CONSTRAINT [FK_clientTransactions_Client] FOREIGN KEY([ClientId])
REFERENCES [dbo].[Client] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Visit] NOCHECK CONSTRAINT [FK_clientTransactions_Client]
GO
ALTER TABLE [dbo].[Visit] WITH NOCHECK ADD CONSTRAINT [FK_ServicePointStatistic_Version] FOREIGN KEY([VersionId])
REFERENCES [dbo].[Version] ([ID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Visit] CHECK CONSTRAINT [FK_ServicePointStatistics_Version]
存储过程插入
Stored Procedure to insert
ALTER Procedure [dbo].[Visit_Insert]
@VerId bigint,
@ClientId bigint,
@VisitDate datetime,
@VisitId char(10),
@Child nvarchar(50),
@CurrentMeth nvarchar(50),
@FollUp nvarchar(50),
@GestAge nvarchar(50),
@MedicalRef nvarchar(50),
@Sensitive nvarchar(50),
@MarketingRef nvarchar(50),
@Category nvarchar(50),
@Id bigint OUTPUT
AS
insert into Visit
(VerId,
ClientId,
VisitDate,
VisitId,
Child,
CurrentMeth,
FollUp,
GestAge,
MedicalRef,
Sensitive,
MarketingRef,
Category)
values
(@VerId,
@ClientId,
@VisitDate,
@VisitId,
@Child,
@CurrentMeth,
@FollUp,
@GestAge,
@MedicalRef,
@Sensitive,
@MarketingRef,
@Category)
SET @Id = @@IDENTITY
RETURN @Id
谢谢
Thanks
推荐答案
这篇关于独特的键声音错误....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!