存储过程
ALTER procedure mysp_get
as
set nocount on
declare @ss int
select @ss=count(*) from Employees
return @ss
set nocount off
代码:
cmd=new SqlCommand("mysp_get",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add(
new SqlParameter("ReturnValue", SqlDbType.Int, 4,
ParameterDirection.ReturnValue, false, 0, 0,
string.Empty, DataRowVersion.Default, null));
cmd.ExecuteNonQuery();
Response.Write(cmd.Parameters["ReturnValue"].Value.ToString());
conn.Close();
返回9。正确。
NND,干了件蠢事,呵呵。
多谢大家参予,结贴~