<%@Import Namespace="system.data"%>
<%@Import Namespace="system.data.sqlclient"%>
<html>
<asp:datagrid id="dg" allowpaging="true" pagesize="10" autogeneratecolumns="true" onpageindexchanged="pagechanged"/>
</html>
<script language="vb" runat="server">
Sub page_load(sender as object,e as eventargs)
dim strconn as string="server=svr;database=northwind;uid=sa;password=;"
dim conn as new sqlconnection(strconn)
dim strsql as string="select * from customers"
dim cmd as new sqlcommand(strsql,conn)
dg.datasource=cmd.executereader()
dg.databind()
End sub
Sub changepage(sender as object,e as datagridpagechangedeventargs)
dg.currentpageindex=e.newpageindex
dim strconn as string="server=svr;database=northwind;uid=sa;password=;"
dim conn as new sqlconnection(strconn)
dim strsql as string="select * from customers"
dim cmd as new sqlcommand(strsql,conn)
dg.datasource=cmd.executereader()
dg.databind()
End sub
</script>
<%@Import Namespace="system.data.sqlclient"%>
<html>
<asp:datagrid id="dg" allowpaging="true" pagesize="10" autogeneratecolumns="true" onpageindexchanged="pagechanged"/>
</html>
<script language="vb" runat="server">
Sub page_load(sender as object,e as eventargs)
dim strconn as string="server=svr;database=northwind;uid=sa;password=;"
dim conn as new sqlconnection(strconn)
dim strsql as string="select * from customers"
dim cmd as new sqlcommand(strsql,conn)
dg.datasource=cmd.executereader()
dg.databind()
End sub
Sub changepage(sender as object,e as datagridpagechangedeventargs)
dg.currentpageindex=e.newpageindex
dim strconn as string="server=svr;database=northwind;uid=sa;password=;"
dim conn as new sqlconnection(strconn)
dim strsql as string="select * from customers"
dim cmd as new sqlcommand(strsql,conn)
dg.datasource=cmd.executereader()
dg.databind()
End sub
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货