output 输出参数 在C# 中的获取方法
新建存储过程
create proc Test
@ID int,
@maxnum int output
as
begin declare @num int
select id,name,sex from T1 where id = @ID select @num=max(num) from T2 where id = @ID
set @maxnum = @num end
go
C#中获取输出参数\
Database _db = DatabaseFactory.CreateDatabase();
DbCommand _cmd =_db.GetStoredProcCommand("Test");
_db.AddInParameter(_cmd, "@ID", DbType.Int32, id);
_db.AddOutParameter(_cmd,"@PageCount",DbType.Int32,int.MaxValue);
DataSet ds = _db.ExecuteDataSet(_cmd);
Int maxnum = Convert.ToInt32(_db.GetParameterValue(_cmd,"@PageCount"));