文件名称:科奥制冷网站
文件大小:1.29MB
文件格式:RAR
更新时间:2016-12-22 04:19:09
sje
public partial class Manages_ManageLogins : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { try { if (TextBox1.Text == "" || TextBox2.Text == "") { this.Page.RegisterStartupScript("ss", ""); return; } else { string num = this.TextBox3.Text.Trim(); if (Session["ValidNums"].ToString() == num.ToUpper()) { // 连接数据库 string Straddcon = Server.MapPath("../kocooldb.mdb"); OleDbConnection sqlcon = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + Straddcon); sqlcon.Open(); string strselect = "select * from tb_user where username='" + TextBox1.Text.Trim() + "'"; OleDbDataAdapter adsas = new OleDbDataAdapter(strselect, sqlcon); DataSet addss = new DataSet(); adsas.Fill(addss); if (addss.Tables[0].Rows.Count > 0) { //SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ConnectionString); //sqlcon.Open(); string strselect1 = "select * from tb_user where username='" + TextBox1.Text.Trim() + "' and pwd='" + TextBox2.Text.Trim() + "'"; OleDbCommand sqlcmd1 = new OleDbCommand(strselect1, sqlcon); OleDbDataReader dr1 = sqlcmd1.ExecuteReader(); if (dr1.Read()) { //Request["userid"] = dr1["id"].ToString(); Session["username"] = TextBox1.Text; Response.Redirect("Manages.aspx"); } else { this.Page.RegisterStartupScript("ss", ""); return; } dr1.Close(); //sqlcon.Close(); } else { this.Page.RegisterStartupScript("ss", ""); return; } sqlcon.Close(); } else { this.Page.RegisterStartupScript("ss", ""); return; } } } catch (Exception ex) { this.Page.RegisterStartupScript("ss", ""); } } protected void Button2_Click(object sender, EventArgs e) { } }