开发工具:
文件大小: 1mb
下载次数: 0
上传时间: 2014-01-14
详细说明: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; public partial class userShow : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Label1.Text = System.DateTime.Now.ToString(); loadData(); } protected void Button2_Clic k(object sender, EventArgs e) { OleDbConnection conn; OleDbCommand cmd; string olecmd, oleString,value; value = this.TextBox1.Text; Session.Add("key", value); oleString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("news.mdb"); olecmd = "select * from userLoad where userName='"; olecmd += TextBox1 .Text.Trim(); olecmd += "'and userPassword='"; olecmd += TextBox2 .Text.Trim() + "'"; conn = new OleDbConnection();//实例化对象 conn.ConnectionString = oleString; cmd = new OleDbCommand(); cmd.Connection = conn; cmd.CommandText = olecmd; conn.Open(); OleDbDataReader dr = cmd.ExecuteReader(); if (this.TextBox1.Text.Trim() == "" || this.TextBox2.Text.Trim() == "") { Response.Redirect("usersub.aspx"); } if (dr.Read()) { Session["username"] = this.TextBox1.Text; Response.Redirect("todayNews.aspx"); } else { this.TextBox1 .Focus(); this.TextBox1 .Text = ""; this.TextBox2 .Text = ""; } conn.Close(); dr.Close(); } protected void Button3_Click(object sender, EventArgs e) { this.TextBox1.Focus(); this.TextBox1.Text = ""; this.TextBox2.Text = ""; } DataSet GetDataSet() { OleDbConnection conn; OleDbCommand cmd; conn = new OleDbConnection(); conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("news.mdb"); conn.Open(); cmd = new OleDbCommand(); cmd.CommandText = "select * from newsData where newsclassid=0"; cmd.Connection = conn; OleDbDataAdapter oleDA = new OleDbDataAdapter(); oleDA.SelectCommand = cmd; DataSet ds = new DataSet(); oleDA.Fill(ds, "newsData"); conn.Close(); return ds; } void loadData() { DataSet ds = GetDataSet(); GridView1.DataSource = ds; GridView1.DataBind(); } protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("userLogin.aspx"); } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; loadData(); } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.