我有一个定义如下的存储过程来检查重复电子邮件的存在:
USE [SQL2008_850994_onebizness]
GO
/****** Object: StoredProcedure [dbo].[EmailExists] Script Date: 04/07/2013 15:14:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[EmailExists]
@EmailID Nvarchar(50),
@Success int output,
@msg varchar(50) output
AS
BEGIN
IF EXISTS(SELECT 1 FROM dbo.Membership WHERE EmailId = @emailID)
OR EXISTS(SELECT 1 FROM dbo.Allocation where ResourceEmail=@emailID)
begin
set @Success=6
set @msg='Duplicate Email found. Please try again.'
--Insert the records in the database
end
END
我在 C# 代码中检索成功的值,如下所示:
int returnVal = int.Parse(myCOmmand.Parameters["@Success"].ToString());
我收到错误消息“输入值的格式不正确”。
有人可以让我知道导致错误的原因吗?