如何调用这个输出参数的存储过程谢谢了
create procedure [dbo].[proc_MaxNum]
@maxNum int output
as
begin
set @maxNum=(select top 1 COUNT(GID) as Number from dbo.Group_InternalMember group by UserID,UserName order by Number desc)
--return @maxNum
end
下面是我写的肯定不对
public DataSet maxNum()
{
SqlParameter[] parameters = {
new SqlParameter("@maxNum", SqlDbType.Int),
};
parameters[0].Value ="-1" ;
DataSet sa = DbHelperSQL.RunProcedure("proc_MaxNum", parameters, "ds");
return DbHelperSQL.RunProcedure("proc_MaxNum", parameters, "ds");
}
谁知道怎么调这个存储过程
并返回输出参数
------解决方案--------------------
--------Procedure
create procedure [dbo].[proc_MaxNum]
@maxNum int output
as
begin
set @maxNum=(select top 1 COUNT(GID) as Number from dbo.Group_InternalMember group by UserID,UserName order by Number desc)
SELECT @maxNum AS MAXNUM
end
-----------Code
public DataSet maxNum()
{
SqlParameter[] parameters = {
new SqlParameter("@maxNum", SqlDbType.Int),
};
parameters[0].Value ="-1" ;
-----这里就是用返回int的方法去调用
比如:
Int32 Result = DbHelperSQL.RunProcedure("proc_MaxNum", parameters, "ds");
}