EF存储过程
2024-10-22 05:17:52
select * from Goods
--创建存储过程
create proc sp_Show
(
@index int, --当前页
@size int, --每页大小
@totalcount int out, --总数据数
@pagecount int out --总页数
)
as
begin
--计算总数据数
select @totalcount=COUNT(*) from Goods --(where name like '%'+ @name +'%')
--计算总页数
set @pagecount=CEILING(@totalcount*1.0/@size)
if(@index<=0)
set @index=1
if(@index>=@pagecount)
set @index=@pagecount
--分页查询
select * from
(select ROW_NUMBER() over(order by GId) rn,*from Goods) tb1 where ----(where name like '%'+ @name +'%')
rn between ((@index-1)*@size)+1 and (@index*@size)
end
declare @x int,@y int
exec sp_Show 1,2,@x out,@y out
select @x 总数据数,@y 总页数
最新文章
- UVA数学入门训练Round1[6]
- 2424: [HAOI2010]订货
- js简单上传进度条
- QT5.4关联VS2010,配置VAssistX关联Qt类
- .NET 4.0 兼容 .NET 2.0 的方法
- 再关于IE11
- Python中安装numpy,scipy,matplotlib安装方法
- hdu4746 Mophues
- POJ 1755 Triathlon [半平面交 线性规划]
- JavaScript 克隆
- Database Change Notification
- jquery 获取name一样的值
- Android 手机版 ssr
- CNN(卷积神经网络)、RNN(循环神经网络)、DNN,LSTM
- Python logging模块简介
- Nginx服务器的图片防盗链
- Dubbo服务容错
- CSS实现鼠标悬浮无限向下级展示的简单代码
- Jquery 的ajax里边不能识别$(this)
- Unity 网格 绘制