码迷,mamicode.com
首页 > Web开发 > 详细

Jquery-EasyUI学习2~

时间:2016-07-10 21:45:11      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:

下面这个Demo用的是MVC+Ado.Net、存储过程

实现功能:分页查询,添加、修改功能。模糊查询功能

先来几张效果图:

 技术分享技术分享技术分享

技术分享

创建存储过程如下

技术分享
go
create proc usp_FenYe2
@selId int,
@selName nvarchar,
@pageIndex int,
@pageSize int,
@recordCount int output,
@pageCount int output
as 
begin
if @selId!=0 and (@selName=‘‘)
begin
select *from(
select *,rn=ROW_NUMBER() over(order by UserId) from UserMsg where IsDelete=1 and( UserId=@selId)
)as t where t.rn between ((@pageIndex-1)*@pageSize+1) and @pageIndex*@pageSize
set @recordCount=(select count(*) from (select *from UserMsg where IsDelete=1 and( UserId=@selId))as t);
set @pageCount=CEILING((@recordCount*1.0)/@pageSize)
end
else if @selId=0 and (@selName!=‘‘)
begin
select *from(
select *,rn=ROW_NUMBER() over(order by UserId) from UserMsg where IsDelete=1 and( UserName like %+@selName+%)
)as t where t.rn between ((@pageIndex-1)*@pageSize+1) and @pageIndex*@pageSize
set @recordCount=(select count(*) from (select * from UserMsg where IsDelete=1 and( UserName like %+@selName+%))as t);
set @pageCount=CEILING((@recordCount*1.0)/@pageSize)
end
else if @selId!=0 and(@selName!=‘‘)
begin
select *from(
select *,rn=ROW_NUMBER() over(order by UserId) from UserMsg where IsDelete=1 and(UserId=@selId or(UserName like %+@selName+%))
)as t where t.rn between ((@pageIndex-1)*@pageSize+1) and @pageIndex*@pageSize
set @recordCount=(select count(*) from (select *from UserMsg where IsDelete=1 and(UserId=@selId or (UserName like %+@selName+%)))as t);
set @pageCount=CEILING((@recordCount*1.0)/@pageSize)
end
else 
begin
select *from(
select *,rn=ROW_NUMBER() over(order by UserId) from UserMsg where IsDelete=1)as t where t.rn between ((@pageIndex-1)*@pageSize+1) and @pageIndex*@pageSize
set @recordCount=(select count(*) from UserMsg);
set @pageCount=CEILING((@recordCount*1.0)/@pageSize)
end
end
go
View Code

 

整个项目代码见:https://github.com/shuai7boy/easyUITest

 

Jquery-EasyUI学习2~

标签:

原文地址:http://www.cnblogs.com/shuai7boy/p/5658472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!