您的位置:首页 > 数据库

存储过程中执行参数SQL语句

2011-06-09 15:05 531 查看
--计算总记录数

if (@SqlWhere='' or @sqlWhere=NULL)
set @sql = 'select @totalRecord = count(*) from ' + @TableName
else
set @sql = 'select @totalRecord = count(*) from ' + @TableName + ' with(nolock) where ' + @sqlWhere

EXEC sp_executesql @sql,N'@totalRecord int OUTPUT',@totalRecord OUTPUT--计算总记录数
end

--计算总页数
select @TotalPage=CEILING((@totalRecord+0.0)/@PageSize)

单个参数输出

prams[10].Direction = ParameterDirection.Output;
DataSet ds = helper.ExecuteDataSet("uspGetNewArrives", prams);
recordCount = int.Parse(prams[10].Value.ToString());
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: