请你评一下我这个用VB写的分页的性能怎么样,是用DATASET(a,b,c,d)这个方法得到的数据
2009-03-23 23:06
543 查看
<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>
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>
相关文章推荐
- 使用微软企业库,非分页sql语句得到分页数据方法
- 记录一下PHP数组数据分页的方法
- webservice 优化性能的方法,以返回Dataset为例,当大数据量时采用先压缩的方式,调用再解压缩
- webservice 优化性能的方法,以返回Dataset为例,当大数据量时采用先压缩的方式,调用再解压缩
- 第一次载入这个grid组件时就给这个grid组件初始化数据并选中其中的某一项,但始终无法选中,经单步调试发现,选中行的方法已被执行了,只是在所有的东西都执行完后,grid又刷新了一下,导致原先选中的项
- 记录一下PHP数组数据分页的方法
- TP5分页使用方法,在使用paginate(10)后无法foreach得到的数据集合
- 利用DataSet的Fill方法实现DataList的分页技术(vb.net)
- 记录一下PHP数组数据分页的方法 array_slice() 函数的使用
- ASP.NET数据分页的多种实现方法及性能比较
- ListView动态加载数据分页(使用Handler+线程和AsyncTask两种方法)
- 大数据Spark “蘑菇云”行动第77课:Spark Streaming性能调优思考和实践方法,发现磁盘空间没有了,怎么办
- ASP Recordset 分页显示数据的方法(修正版)
- sql T_sql 巧用with做自定义数据表分页方法
- MySQL单表百万数据记录分页性能优化
- bootstrap-table当查询后再去点击分页时,后台返回的数据是正确的,前台也显示正确了,但是当我点击分页时,列表会刷新为最初的数据,而不再是本次查询得到的数据
- ArcEngine数据删除几种方法和性能比较
- DataSet、DataTable、DataRow的数据复制方法
- 关于VB调用Access的Rnd函数随机返回表中数据的解决方法
- Ext中Grid得到选择行数据的方法总结