protected void Button1_Click(object sender, EventArgs e)
{
string s = "";
string str = "insert into zhuce (yonghuming,mima,dizhi,shoujihao,youxiang) values ('" + yonghuming.Text + "','" + mima.Text + "','" + dizhi.Text + "','" + zcshouji.Text + "','" + zcyouxiang.Text + "')";
OleDbConnection con = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["SQLConnString"].ToString());
con.Open();
OleDbCommand com = new OleDbCommand(str, con);
int ss = com.ExecuteNonQuery();
con.Close();
if (s == "")
{
Response.Redirect("~/登陆.aspx");
}
else
{
Label1.Text = "注册失败";
}
zhuceq zhu = new zhuceq();
zhu.Yonghuming = yonghuming.Text;
zhu.Mima = mima.Text;
Session["zhuceq"] =zhu ;
这是在注册页面 的代码 protected void Button1_Click(object sender, EventArgs e)
{
string yonghuming = this.TextBox1.Text.Trim();
string mima = this.TextBox2.Text.Trim();
string str = "select yonghuming from zhuce where yonghuming='" + TextBox1.Text.Trim() + "'and mima='" + TextBox2.Text.Trim() + "'";
OleDbConnection con = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings["SQLConnString"].ToString());
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter(str, con);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
if (ds.Tables[0].Rows.Count > 0)
{
Session["yonghuming"] = this.TextBox1.Text;
Response.Redirect("~/首页.aspx");
TextBox1.Text = ((zhuceq)Session["zhuceq"]).Yonghuming;
TextBox2.Text = ((zhuceq)Session["zhuceq"]).Mima;
}
else
{
Response.Write("<script>alert('用户帐号/密码错误。')</script>");
}
}
这是登录页面的代码
帮忙看看是哪里有问题?