题库管理系统论文(5)

2019-04-23 18:42

conn.Open();

sql = \; SqlDataAdapter da = new SqlDataAdapter(sql, conn); DataSet ds = new DataSet(); da.Fill(ds);

DataTable dt = ds.Tables[0];

if (dt.Rows.Count > 0) {

PagedDataSource pds = new PagedDataSource(); pds.DataSource = ds.Tables[0].DefaultView;

pds.AllowPaging = true; pds.PageSize = 10; int curPage;

if (Request.QueryString[\] != null) {

curPage = Convert.ToInt32(Request.QueryString[\]); } else {

curPage = 1; }

pds.CurrentPageIndex = curPage - 1; this.Repeater1.DataSource = pds; this.Repeater1.DataBind();

this.Label1.Text += \共有\ + ds.Tables[0].Rows.Count.ToString() + \条记录 \;

this.Label1.Text += \每页显示\ + pds.PageSize + \条 \;

this.Label1.Text += \共\ + pds.PageCount.ToString() + \页 \;

this.Label1.Text += \当前第\ + curPage.ToString() + \页  \;

if (curPage == 1) {

this.Label1.Text += \首页 \; this.Label1.Text += \上一页 \; }

19

else {

this.Label1.Text += \首页 \; this.Label1.Text += \ + (curPage - 1).ToString() + \上一页  \; }

if (curPage == pds.PageCount) {

this.Label1.Text += \下一页  \; this.Label1.Text += \尾页  \; } else {

this.Label1.Text += \ + (curPage + 1).ToString() + \下一页  \;

this.Label1.Text += \href='uTeacherManage.aspx?page=\ + pds.PageCount.ToString() + \尾页  \; }

string HtmlSelectString = \onchange=\\\; for (int i = 1; i <= pds.PageCount; i++) {

if (i == curPage) {

HtmlSelectString += \ + i + \第\ + i + \页\; } else {

HtmlSelectString += \ + i + \第\ + i + \页\; } }

HtmlSelectString += \;

this.Label1.Text += \ + HtmlSelectString + \; } else {

this.Label1.Text = \当前没有记录\; }

ds.Dispose(); da.Dispose();

20

conn.Close(); conn.Dispose(); }

protected void Button1_Click(object sender, EventArgs e) {

if (txtKey.Text == \) //查询 {

string sqlnn = \; sqloperate.dlRepeterBind(Repeater1, sqlnn);

} else {

string sqlnn = \ + ddlCondition.SelectedValue + \'%\ + txtKey.Text.Trim() + \;

sqloperate.dlRepeterBind(Repeater1, sqlnn); } }

protected void txtKey_TextChanged(object sender, EventArgs e) { }

protected void Button3_Click(object sender, EventArgs e) {

Export(\, \教师个人信息表.doc\); }

private void Export(string FileType, string FileName) {

Response.AppendHeader(\, \ +

21

HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); Response.ContentType = FileType; this.EnableViewState = false;

StringWriter tw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); Repeater1.RenderControl(hw); Response.Write(tw.ToString()); Response.End(); }

public override void VerifyRenderingInServerForm(Control control) { }

protected void Button4_Click(object sender, EventArgs e) {

Export1(\, \教师信息报表.xls\); }

private void Export1(string FileType, string FileName) {

Response.Charset = \;

Response.ContentEncoding = System.Text.Encoding.UTF7;

Response.AppendHeader(\, \ + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString()); Response.ContentType = FileType; this.EnableViewState = false;

StringWriter tw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(tw); Repeater1.RenderControl(hw); Response.Write(tw.ToString()); Response.End(); } }

22

string sql;

protected void Page_Load(object sender, EventArgs e) {

if (!this.IsPostBack) {

if (Request.QueryString[\] == \) {

zp_txt();

}

else if (Request.QueryString[\] == \) {

del_zp(); }

} }

public void zp_txt()//显示文本信息 {

int ID = int.Parse(Request.QueryString[\]); sql = \ + ID; DataTable dt = Class1.ExecSel(sql);

TextBox1.Text = Convert.ToString(dt.Rows[0][\]); TextBox2.Text = Convert.ToString(dt.Rows[0][\]);

23


题库管理系统论文(5).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

Copyright © 2019-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18

× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: