六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

像Asp一樣簡單分頁顯示數據(C#)

[摘要]代碼如下:<%@ Page Language="C#" Debug="true" %><%@Import Namespace="System.Data"%><%@Import Namespace="...

代碼如下:

<%@ Page Language="C#" Debug="true" %>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.SqlClient"%>
<Script Language="C#" runat="server">
int Record_Per_Page;//定義每頁顯示記錄數
int nPageCount;//定義總頁數
int nRecCount;//定義總記錄數
int nPage;//定義當前頁
void Page_Load(Object src,EventArgs e){
//取得當前頁數值,并判斷
if(Request["pagesize"]==null)
Record_Per_Page=9;
else
Record_Per_Page=Convert.ToInt32(Request["pagesize"]);
//連接數據庫
SqlConnection conn;
conn =new SqlConnection(ConfigurationSettings.AppSettings["strconn"]);
conn.Open();

//執行SQL語句
string ConnStr="select id,name,demo,pic from download where classid=23 or classid=24 order by time desc";
SqlDataAdapter odAdapt = new SqlDataAdapter(ConnStr,conn);
DataSet DS = new DataSet();
odAdapt.Fill(DS);
DataTable DT = DS.Tables[0];
//獲得總記錄數
nRecCount = DT.Rows.Count;

//判斷是否存在數據記錄
if(nRecCount > 0){
//確定數據記錄要顯示的頁面數
  nPageCount=nRecCount/Record_Per_Page;
if(nRecCount % Record_Per_Page > 0)
 nPageCount ++;
if(nPage < 1)
    nPage = 1;
if(nPage > nPageCount)
    nPage = nPageCount;
//將頁數顯示到屏幕上,并作鏈接
for(i=1;i<=nPageCount;i++){
   html=html+"<a href='mblist.aspx?page="+i+"&id="+classid+"&classname="+Request.Params["classname"]+"pagesize="+Record_Per_Page+"'>";
   if(i==nPage)
   html=html+"<b>"+i+"</b>";
   else
   html=html+i;
   html=html+"</a> ";
  }
  pagelist.InnerHtml=html;
  html="";
//確認當前頁面的開始記錄和終止記錄
  int nStart = Record_Per_Page * (nPage - 1);
  int nEnd = nStart + Record_Per_Page - 1;
if(nEnd > nRecCount - 1)
    nEnd = nRecCount - 1;
//在屏幕中輸出記錄
  html="<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='95%' height='139' bgcolor='#ffffff'><tr>";
  int j=0;
  for(i=nStart;i<=nEnd;i++){
    html+="<td align=center height=180 ><table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='145'><tr><td align=center><img src='http://bbs.wrclub.net/templates/"+DT.Rows[i]["demo"].ToString().Trim()+"/"+DT.Rows[i]["pic"].ToString().Trim()+"' height=143 width=140 border=0 alt='"+DT.Rows[i]["name"].ToString().Trim()+"'></td></tr><tr><td width='100%' background='images/mbbg.gif'><table border='0'cellpadding='0'cellspacing='0'width='100%'><tr><td width='50%'><a target='_blank'><img src='http://www.okasp.com/techinfo/images/view.gif' border=0></a></td><td width='50%' align=right><a href='mbdown.aspx?id="+DT.Rows[i]["id"]+"' target=_blank><img src='http://www.okasp.com/techinfo/images/down.gif' border=0></a></td></tr></table></td></tr></table></td>";
    j++;
    if(j%3==0)
    html+="</tr><tr>";
 }
  html+="</tr></table>";
  mblist.InnerHtml=html;
  html="";
}
conn.Close();
}
</script>

 

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=Request.Params["classname"]%>:網人俱樂部</title>
<meta name="Keywords" CONTENT="學習,免費資源,asp,jsp,flash,photoshop,社區,論壇,同學錄,電子圖書,網站建設,宣傳,推廣,聊天,數據庫,經驗心得,游戲,game,電子超市,網人交流論壇,插件,下載">
<meta name="description" CONTENT="提供網站建設、開發方面的學習資料、經驗心得,同時提供免費的電子書籍、網站免費資源、制作工具、插件、濾鏡,網站還有網上電子超市、論壇、網人交流論壇">
<link rel="stylesheet" type="text/css" href="style.css"><link rel="Shortcut Icon" href="favicon.ico">
</head>
<body topmargin="0" leftmargin="0"><form runat=server action="?id=22&classname=模板中心">
<!-- #Include File="top.inc" -->
<div align="center">
  <center>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="92">
      <tr>
        <td width="375" height="92" rowspan="2"><img src="images/wrclub_l<%=Request.Params["id"]%>.jpg" width="375" height="92">
        </td>
      <td height="24" width="403" background="images/bg3.gif"> <span id="myclass" runat="server"></span></td>
    </tr>
    <tr>
        <td width="403" height="68" valign="top">
          <!-- #Include File="bbslogin.inc" --> </td>
    </tr>
  </table>
    <table width="778" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20" background="http://www.okasp.com/techinfo/images/bg5.gif"><img src="http://www.okasp.com/techinfo/images/bg5.gif" width="7" height="24"></td>
      </tr>
    </table>
    <table width="778" border="0" cellpadding="0" cellspacing="0" bgcolor="#D8D8D8">
      <tr>
          <td width="562" height="400" align="center" valign="top">
    <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
              <tr>
                <td width="37%"> &nbsp;<img src="http://www.okasp.com/techinfo/images/favorites.gif" width="16" height="16">
                  <a href="default.aspx">網人俱樂部</a> -- 模板中心</td>
                <td width="63%" align=center>·共有模板 <%=nRecCount%> 個 ·共有 <%=nPageCount%>
                  頁 ·每頁顯示
            <select id=Select21 size=1 name="pagesize" onChange="var URL=this.options[this.selectedIndex].value; if(URL!='') {self.location=URL;} else {this.selectedIndex=0;}" style="font-size: 9pt; font-family: 宋體; background-color: #b6b1cb; color: #000000" tabindex="1">
            <option value="?id=22&classname=模板中心&page=<%=nPage%>&pagesize=9" ><font face="Arial">9 </font></option>
            <option value="?id=22&classname=模板中心&page=<%=nPage%>&pagesize=12"><font face="Arial">12</font></option>
            <option value="?id=22&classname=模板中心&page=<%=nPage%>&pagesize=15"><font face="Arial">15</font></option>
            <option value="?id=22&classname=模板中心&page=<%=nPage%>&pagesize=18"><font face="Arial">18</font></option>
            <option value="?id=22&classname=模板中心&page=<%=nPage%>&pagesize=21"><font face="Arial">21</font></option></select>個</td>
  </tr>
</table>
 <span id="mblist" runat="server"></span>
            <table width="95%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
              <tr>
                <td height="16" align=center> <span id="pagelist" runat="server" ></span> </td>
              </tr>
</table><br>
 </td>
        <td width="216" valign="top">
          <table width="202" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="5" height="100%" valign="top" background="images/yy_bg.gif"><img src="http://www.okasp.com/techinfo/images/yy1_bg.gif" width="8" height="16"></td>
              <td width="193" height="100%" bgcolor="#FFFFFF" valign="top">
     <table width="100%" border="0" cellspacing="0" cellpadding="0" height="24"

style="border-collapse: collapse; border-left-width: 1; border-right-width: 1; border-top-width:

1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#111111">
  <tr>
    <td align="center">下載排行</td>
  </tr>
</table><br>
<span id="downhot" class="p1" runat="server"></span></td>
              <td width="5" height="100%" valign="top" background="images/yy_bg1.gif"><img src="http://www.okasp.com/techinfo/images/yy1_bg1.gif" width="9" height="15"></td>
            </tr>
          </table></td>
      </tr>
    </table>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="778" height="1">
      <tr>
        <td background="images/nod0a.gif"></td>
      </tr>
    </table>
    <!-- #Include File="footer.inc" -->
  </center>
</div></form>
</body></html>

 




主站蜘蛛池模板: 特级aaa片毛片免费观看 | 亚洲五月六月丁香激情 | 日本人成大片在线 | 亚洲高清视频在线观看 | 啪啪免费网站 | 在线bt在线www天堂网在线 | 色天天网| 中文字幕午夜乱理片 | 色综合色综合色综合 | 网站久久| 日本天天色 | 欧美行性性性o00x | 日韩欧美亚洲国产精品字幕久久久 | 日本免费的一级v一片 | 日韩高清中文字幕 | 亚洲一区二区三区四区在线 | 青青在线视频免费看观看 | 婷婷 色天使 | 日韩视频免费在线观看 | 日韩毛片免费在线观看 | 色橹橹高清视频在线播放 | 天堂在线最新版www中文 | 日本邪恶全彩 | 天堂√中文在线 | 视频在线观看h | 欧美中出在线 | 青春草在线视频精品 | 全黄色毛片 | 亚洲网站在线 | 天天操天天摸天天曰天天干天天弄天天干 | 亚州免费一级毛片 | 热re99久久国产精品 | 日本三级韩国三级香港三级网站 | 日本成人午夜 | 性8成人有声小说在线播放 性 色 黄 一级 | 欧美午夜成年片在线观看 | 日本高清在线观看视频你懂的 | 在线观看视频一区二区三区 | 日韩在线一区视频 | 在线国产一区二区 | 午夜精品久久久久久 |