日期:2014-05-19  浏览次数:20699 次

存储过程,不明白参数如何被调出来的,着急!
调用数据库存储过程
private   void   InitializeComponent()
{       this.cmdInsertGiftbook.CommandText   =   "dbo.[spInsertGiftbook] ";
this.cmdInsertGiftbook.CommandType   =   System.Data.CommandType.StoredProcedure;
this.cmdInsertGiftbook.Connection   =   this.cnAddGiftbook;
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@RETURN_VALUE ",   System.Data.SqlDbType.Int,   4,   System.Data.ParameterDirection.ReturnValue,   false,   ((System.Byte)(0)),   ((System.Byte)(0)),   " ",   System.Data.DataRowVersion.Current,   null));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@CustomerID ",   System.Data.SqlDbType.Int,   4));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@ISBNList ",   System.Data.SqlDbType.NVarChar,   4000));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@UserName ",   System.Data.SqlDbType.NVarChar,   16));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@GiftbookTypeID ",   System.Data.SqlDbType.Int,   4));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@Number ",   System.Data.SqlDbType.Int,   4));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@ReleaseDatetime ",   System.Data.SqlDbType.DateTime,   8));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@Feedback ",   System.Data.SqlDbType.NVarChar,   1073741823));
this.cmdInsertGiftbook.Parameters.Add(new   System.Data.SqlClient.SqlParameter( "@Memo ",   System.Data.SqlDbType.NVarChar,   1073741823));
this.Load   +=   new   System.EventHandler(this.Page_Load);

}


cmdInsertGiftbook.ExecuteNonQuery();

int   returnvalue   =   int.Parse(cmdInsertGiftbook.Parameters[ "@RETURN_VALUE "].Value.ToString());

if(returnvalue   ==   0)
{
lbResult.Text   =   "图书书号不正确。请检查是否存在相应的图书。 ";
}------这是可以执行出来的
else   if(returnvalue   ==   -3)
{
lbResult.Text   =   "该图书已经报废了。 ";
}---我想添加的怎么也不能返回参数


存储过程如下:是在不知这个0是如何传递过去的
CREATE   PROCEDURE   dbo.spInsertGiftbook
(
@CustomerID   int,
@ISBNList   nvarchar(4000),
@UserName   nvarchar(16),
@GiftbookTypeID   int,
@Number   int,
@ReleaseDatetime   datetime,
@Feedback   ntext,
@Memo   ntext
)
AS
SET   NOCOUNT   OFF;

--DECLARE   @BookID   int
--DECLARE   @IsOutOfPrint   int
DECLARE   @ProvinceID   int

SELECT   @ProvinceID   =   dbo.GetProvinceID(N 'CustomerID ',   @CustomerID)

--   检查该用户针对该省份是不是有写权限
IF   (dbo.CheckUserProvinceWriteInfo(@UserName,   @ProvinceID)   =   0)
RETURN   -1

SET   @ISBNList   =   LTRIM(RTRIM(@ISBNList))

SELECT   LTRIM(RTRIM(SplitString))   AS   ISBN   INTO   #TempBookISBNList   FROM   dbo.GetSplitString(@ISBNList,   ', ')

/*
SELECT   @BookID   =   Bo