Enlib 中的 AddInParameter,AddOutParameter,AddParameter简单用法
Database db = MTH2HBaseLib.DataEntHelper.CreateDatabase();
DbCommand dbcSelect = db.GetStoredProcCommand("pExmCheckAssDealID");
dbcSelect.CommandTimeout = StructSystemConst.CommandTimeOut;
db.AddInParameter(dbcSelect, "DealID", DbType.String, strDealID);
db.AddOutParameter(dbcSelect, "msg", DbType.String, 1000);
db.AddParameter(dbcSelect, "rstcount", DbType.Int32, ParameterDirection.ReturnValue, null,
DataRowVersion.Current, null);
////返回纪录条数
DataSet dstTemp = db.ExecuteDataSet(dbcSelect);
msg = db.GetParameterValue(dbcSelect,"Msg").ToString();
int returnval = int.Parse(db.GetParameterValue(dbcSelect, "rstcount").ToString());
return (returnval > 0);
存储过程
create PROCEDURE pExmCheckAssDealID@Dealid nvarchar(500),
@msg nvarchar(max) output
AS
BEGIN
DECLARE @rstcount int
declare @status int
declare @caseid nvarchar(40)
set @msg = '业编' + @Dealid + '不能被关联,可能未上数或者已结案'
SELECT @rstcount = count(dealid)
FROM vexmdealreport with(nolock)
where dealid = @Dealid and dealid not in
(select dealid from bexmcasemain where isenable = 1 )
if ( @rstcount > 0 )
begin
set @msg = '业编' + @Dealid+ '已经上数,可以关联'
print @rstcount
return @rstcount
end
--存在结案的可以关联
SELECT @rstcount = count(dealid),@caseid = caseid
FROM bexmcasemain with(nolock)
where dealid = @Dealid and
status in (1,2) and isenable = 1
group by caseid
if ( @rstcount > 0 )
begin
--set @msg = '业编' + @Dealid + '已经接案,但是未结案,可以关联'
set @msg= '业编' + @Dealid + '已经接案(<a href="baseinfo.aspx?caseid='
+ @caseid + '" target=''_blank''>查看情况</a>),未结案可以关联(关联后原有案件将被无效)'
print @rstcount
return @rstcount
end
print @rstcount
return @rstcount
END
GO