请你评一下我这个用VB写的分页的性能怎么样,是用DATASET(a,b,c,d)这个方法得到的数据

<script language="vb" runat="server">
 
 sub page_load(objecta as object,e as eventargs)
        Dim sql, rowa, clouma, curridex, uppagea, downpagea, downpageb As String
        Dim autid As String = Request.QueryString("id") ' 要查找的ID号
        Dim ident As String = Request.QueryString("ident") ' 判断要查找的是发表的何种评论
  Dim pagesize As Integer = 5 '定义返回数据数值(行数)
  
  curridex=request.QueryString("curridex")
  if curridex="" then
  curridex=0
  else
  curridex=request.QueryString("curridex")
  end if
  
  
  
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''以下是sql查询语句,  
     If ident = "dfweurjklsdfuiiwerk23d4kjsd" Then
             rowa = "game table"
             clouma = "yxxaaxxgz"
             sql = "SELECT  a.autoid,content,publishtime,a.tablename,[guest ip],title,[themes id]  FROM [visitors book] as a inner join [game table] as b  on a.[themes id]=b.[autoid]  WHERE tablename='" + clouma + "' and [themes id]='" + autid + "'"
        ElseIf ident = "psdfioeorjkxcusdflk3ksd4ks1q" Then
             rowa = "log book table"
             clouma = "xxyyxagz"
             sql = "SELECT  a.autoid,content,publishtime,tablename,[guest ip],title,[themes id]  FROM [visitors book] as a inner join [log book table] as b  on a.[themes id]=b.[autoid]  WHERE tablename='" + clouma + "' and [themes id]='" + autid + "'"
        ElseIf ident = "weriuklsjdfiwerkidufwer3wser" Then
             rowa = "jx music world table"
             clouma = "xammnyg"
             sql = "SELECT  a.autoid,content,publishtime,tablename,[guest ip],title,[themes id]  FROM [visitors book] as a inner join [jx music world table] as b  on a.[themes id]=b.[autoid]  WHERE tablename= '" + clouma + "' and [themes id]='" + autid + "'"
        ElseIf ident = "kiejsdfiwerjkuaisdfkwjer4g" Then
             rowa = "jx world book table"
             clouma = "xyxxaaaxygz"
             sql = "SELECT a.autoid,content,publishtime,[guest ip],title,tablename,[themes id]  FROM [visitors book] as a inner join [jx world book table] as b  on a.[themes id]=b.[autoid]  WHERE  tablename='" + clouma + "' and [themes id]='" + autid + "'"
        Else
            Response.Redirect("fail.htm")
        End If
'''''''''''''''''''''''''''''''''''''''''''''''’‘’‘’‘’‘’sql查询语句结束  
  
  
'’‘’@@@@@‘’‘’‘’‘’‘’‘‘’‘’‘’‘’‘’‘’‘’‘’以下是数据链接代码
        Dim conn As SqlConnection = New SqlConnection
        Dim ad As New SqlDataAdapter()
        Dim comd As SqlCommand
        conn.ConnectionString = "persist security info=false;user id=sa;pwd=amwriuice;database=mysite application;server=(local)"
        conn.Open()
'’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’数据链接代码结束  
  
       
  Try
            comd = New SqlCommand(sql, conn)
            ad.SelectCommand = comd
        Catch ex As Exception
            Response.Redirect("fail.htm")
        End Try
'''''''''''''''''''''''''''''''''统计数据表,绑定到REPEATER "teea" 中
  
  Dim ds As Data.DataSet = New Data.DataSet           '数据填充
  Dim ds1 As Data.DataSet = New Data.DataSet
     Dim cout As String
     ad.fill(ds1, rowa)
     cout = ds1.Tables(rowa).DefaultView.Count()
 
        try
      ad.Fill(ds,curridex, pagesize, rowa)
            Catch ex2 As Exception
            Response.Redirect("fail.htm")
        End Try
  
  
'@@@@’‘’‘’‘’’‘’‘’‘’;'''‘’‘’‘‘’‘’ '赋值代码
  firstpage.text=0'首页
  
  uppage.text=curridex-pagesize '上一页
  uppagea=curridex-pagesize
  if uppagea<0 then
  uppage.text=0
  end if
  
  downpage.text=curridex+pagesize '下一页
  downpagea=curridex-pagesize
  downpageb=curridex
  if downpagea > ((convert.toint16(cout/pagesize))*pagesize) then
  downpage.text=(convert.toint16(cout/pagesize))*pagesize
  else if downpageb > ((convert.toint16(cout/pagesize))*pagesize-pagesize) then
  downpage.text=(convert.toint16(cout/pagesize))*pagesize
  end if
  
  endpage.text=(convert.toint16(cout/pagesize))*pagesize       '末页
''''''’‘’‘’‘’‘’‘@@’‘’‘’‘’‘’‘’‘赋值代码到此结束
       
  
  conn.Close()
        teea.DataSource = ds
        teea.DataBind()
        conn = Nothing
    End Sub
   
</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值