温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:大学生调查投票系统源码
当前文件:
StudentVote/Index.aspx.cs,打开代码结构图
StudentVote/Index.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Web; 5
using System.Web.Security; 6
using System.Web.UI; 7
using System.Web.UI.WebControls; 8
using System.Web.UI.WebControls.WebParts; 9
using System.Web.UI.HtmlControls; 10
using System.Data.SqlClient; 11
12
public partial class _Default : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
} 17
18
public string GetList() 19
{ 20
SqlData da = new SqlData(); 21
SqlDataReader dr = da.ExceRead("select top 5 * from tb_Vote "); 22
string strBody = "<table width=150 align=center>"; 23
while (dr.Read())//循环读取 24
{ 25
strBody += "<tr><td class=tableBottom>·<a href=vote.aspx?ID=" + dr["ID"] + " >" + dr["Title"].ToString() + "</a></td></tr>\n"; 26
} 27
dr.Close();//关闭阅读器 28
strBody += "</table>"; 29
return strBody; 30
} 31
} 32





}
}