zoukankan      html  css  js  c++  java
  • Jquery-EasyUI学习2~

    下面这个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

  • 相关阅读:
    POJ 1011Sticks
    zz 深入浅出CGlib打造无入侵的类代理
    教你如何用SQL备份和还原数据库
    sql server 2008 评估期已过期解决办法
    C# 第三方分页控件的使用
    Listbox移除
    Winwos server2008 IE安全级别设置
    验证手机号码和固定电话正则表达式
    SQL 左外连接,右外连接,全连接,内连接 4种连接的区别
    SQL TOP 和 DISTINCT 结合使用
  • 原文地址:https://www.cnblogs.com/shuai7boy/p/5658472.html
Copyright © 2011-2022 走看看