Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Button1_Click(object sender, EventArgs e)
- {
- con.Open();
- SqlCommand cmd = con.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "select * from registration where email='"+ TextBox1.Text+"' and password='"+TextBox2.Text+"'";
- cmd.ExecuteNonQuery();
- DataTable dt = new DataTable();
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- da.Fill(dt);
- tot = Convert.ToInt32(dt.Rows.Count.ToString());
- if (tot > 0)
- {
- if (Session["checkoutbutton"] == "yes")
- {
- Session["user"] = TextBox1.Text;
- Response.Redirect("update_order_details.aspx");
- }
- else
- {
- Session["user"] = TextBox1.Text;
- Response.Redirect("order_details.aspx");
- }
- }
- else
- {
- Label1.Text = "Invalid email or password";
- }
- con.Close();
- con.Open();
- SqlCommand cmd1 = con.CreateCommand();
- cmd1.CommandType = CommandType.Text;
- cmd1.CommandText = "select * from admin_login where username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "' ";
- cmd1.ExecuteNonQuery();
- DataTable dt1 = new DataTable();
- SqlDataAdapter da1 = new SqlDataAdapter(cmd);
- da1.Fill(dt);
- i = Convert.ToInt32(dt.Rows.Count.ToString());
- if (i == 1)
- {
- Session["admin"] = TextBox1.Text;
- Response.Redirect("add_product.aspx");
- }
- else
- {
- Label1.Text = "you have entered invalid username or password";
- }
- con.Close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement