请谁能给一个完整的ASP.NET的取SQL数据库中表内容且有分页的代码? 要求分页采用存储过程的! 要求分页快!要求是完整的ASP.NET代码! 请谁能提供出来,马上给分!

解决方案 »

  1.   


    建议 你去http://www.webdiyer.com/看看
      

  2.   

    首先是存储过程.
    ALTER procedure UserPager
    (@pagesize int,
    @pageindex int,
    @docount bit)
    /*分页存储过程*/
    as
    set nocount on
    if(@docount=1)
    select count(id) from [user]
    else
    begin
    declare @indextable table(id int identity(1,1),nid int)
    declare @PageLowerBound int
    declare @PageUpperBound int
    set @PageLowerBound=(@pageindex-1)*@pagesize
    set @PageUpperBound=@PageLowerBound+@pagesize
    set rowcount @PageUpperBound
    insert into @indextable(nid) select id from [user] order by id desc
    select O.id,O.username from [user] O,@indextable t where O.id=t.nid
    and t.id>@PageLowerBound and t.id<=@PageUpperBound order by t.id
    end
    set nocount off
    '========================ADMINLIB.VB    '读取全部用户 
        Public Function GetAllUser(ByVal pageindex As Integer, ByVal pagesize As Integer, ByVal docount As Boolean)
            Dim strConn As New PublicLib
            Dim Conn As New SqlConnection(strConn.strconn)
            Dim Comm As New SqlCommand("UserPager", Conn)
            Comm.CommandType = CommandType.StoredProcedure
            Comm.Parameters.Add("@pageindex", pageindex)
            Comm.Parameters.Add("@pagesize", pagesize)
            Comm.Parameters.Add("@docount", docount)
            Conn.Open()
            Return Comm.ExecuteReader(CommandBehavior.CloseConnection)
        End Function
        '这个作用是读取用户的总数用于分页
        Public Function LoadGetAllUser()
            Dim strConn As New PublicLib
            Dim Conn As New SqlConnection(strConn.strconn)
            Dim Comm As New SqlCommand("UserPager", Conn)
            Comm.CommandType = CommandType.StoredProcedure
            Comm.Parameters.Add("@pageindex", 1)
            Comm.Parameters.Add("@pagesize", 1)
            Comm.Parameters.Add("@docount", True)
            Dim CountNum As Integer
            Conn.Open()
            CountNum = Comm.ExecuteScalar
            Conn.Close()
            Return CountNum
        End Function'======表示层    Function DataGrid1DataBind()
            Dim GetAllUser As New AdminLib
            '读出用户总数
            Dim PageSize As Integer = 18 '每页显示数
            Dim CurrentPageIndex As Integer '开始页面
            Dim PageCount As Integer '页总数
            Dim UserCount As Integer = GetAllUser.LoadGetAllUser() '用户个数
            If UserCount Mod PageSize = 0 Then '计算页数.构造URL分页
                PageCount = UserCount \ PageSize
            Else
                PageCount = UserCount \ PageSize + 1
            End If        If Request.Params("PageID") Is Nothing Then
                CurrentPageIndex = 1
            Else
                CurrentPageIndex = CInt(Request.QueryString("PageID"))
            End If
            Dim i As Integer
            Dim PagerUrl As String
            If PageCount = 1 Then
                PagerUrl = "<a href=UserAdmin.aspx?PageID=1 target=main> 1 </a>"
            Else
                For i = 0 To PageCount - 1
                    PagerUrl += "<a href=UserAdmin.aspx?PageID=" & i + 1 & " target=main>" & i + 1 & "</a>&nbsp;"
                Next
            End If
            strPageurl.Text = PagerUrl
            DataGrid1.DataSource = GetAllUser.GetAllUser(CurrentPageIndex, PageSize, False) '参数说明开始页面,页面大小 False ,如果是读取总数就为True
            DataGrid1.DataKeyField = "id"
            DataGrid1.DataBind()
        End Function
      

  3.   

    www.webdiyer.com正是你需要的...
      

  4.   

    [消息]为开发研究asp.net用户免费提供.net空间及数据库. 
         
     
      
    为了更好交流学习asp.net 和.net技术,china825将为如下用户,免费提供.net 空间及sql server数据库.1. bbs.china825.com论坛版块版主(300积分以上)
    2. 公开提供下载资10个以上.
    3. 为本站论坛推广多达200人上.
    4. 公开提供论坛插件模式设计方法并提供相应插件一套,随anf升级变化.
    5. 公开提供论坛其它功能模块或设计,被采用者.
    6. 论坛发贴质量含量高,数量及积分较高者.可提出申请,经批准者.
    7. .net有一定水平,有自己的产品,苦于没有空间,可提出申请,经批准者.注册用户满足以上任一条即可提出申请,经批准提供一定大小.net空间,根据需要相应提供sql server数据库.            礼 小宝  
     
    http://bbs.china825.com/74/ShowPost.aspx#74
      

  5.   

    请问这些控件下载之后怎么用呢?我用vs不能运行,打开项目的时候只能看到bin文件夹