標籤:
下面這個Demo用的是MVC+Ado.Net、預存程序
實現功能:分頁查詢,添加、修改功能。模糊查詢功能
先來幾張:
建立預存程序如下
gocreate proc usp_FenYe2@selId int,@selName nvarchar,@pageIndex int,@pageSize int,@recordCount int output,@pageCount int outputas beginif @selId!=0 and (@selName=‘‘)beginselect *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*@pageSizeset @recordCount=(select count(*) from (select *from UserMsg where IsDelete=1 and( [email protected]))as t);set @pageCount=CEILING((@recordCount*1.0)/@pageSize)endelse if @selId=0 and (@selName!=‘‘)beginselect *from(select *,rn=ROW_NUMBER() over(order by UserId) from UserMsg where IsDelete=1 and( UserName like ‘%‘[email protected]+‘%‘))as t where t.rn between ((@pageIndex-1)*@pageSize+1) and @pageIndex*@pageSizeset @recordCount=(select count(*) from (select * from UserMsg where IsDelete=1 and( UserName like ‘%‘[email protected]+‘%‘))as t);set @pageCount=CEILING((@recordCount*1.0)/@pageSize)endelse if @selId!=0 and(@selName!=‘‘)beginselect *from(select *,rn=ROW_NUMBER() over(order by UserId) from UserMsg where IsDelete=1 and([email protected] or(UserName like ‘%‘[email protected]+‘%‘)))as t where t.rn between ((@pageIndex-1)*@pageSize+1) and @pageIndex*@pageSizeset @recordCount=(select count(*) from (select *from UserMsg where IsDelete=1 and([email protected] or (UserName like ‘%‘[email protected]+‘%‘)))as t);set @pageCount=CEILING((@recordCount*1.0)/@pageSize)endelse beginselect *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*@pageSizeset @recordCount=(select count(*) from UserMsg);set @pageCount=CEILING((@recordCount*1.0)/@pageSize)endendgo
View Code
整個項目代碼見:https://github.com/shuai7boy/easyUITest
Jquery-EasyUI學習2~