Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string strQuery = "select count(*) from Registration where username=@username and password=@password";
- SqlConnection connection = DBConnection.getConnection();
- connection.Open();
- SqlCommand cmd = new SqlCommand();
- cmd.Connection = connection;
- cmd.CommandText = strQuery;
- cmd.Parameters.Add("@username", txt1_username.Text);
- cmd.Parameters.Add("@password", txt2_password.Text);
- int intRowCount = (int) cmd.ExecuteScalar();
- txt1_username.Text = intRowCount.ToString();
- connection.Close();
- if (intRowCount == 1)
- {
- string strquery = "select customer_id from Registration";
- SqlConnection connection2 = DBConnection.getConnection();
- connection2.Open();
- SqlCommand cmd2 = new SqlCommand();
- cmd2.Connection = connection;
- cmd2.CommandText = strquery;
- string customerID = cmd2.ExecuteScalar().ToString();
- Session["customerID"] = customerID;
- connection2.Close();
- Session.Add("username", txt1_username.Text);
- Response.Redirect("Succes.aspx");
- }
- else
- {
- Messages myMsg = new Messages(); // ایجاد نمونه از کلاس
- myMsg.CreateMessageAlert("مقادیر ورودی صحیح نمی باشند . مجددا سعی کنید");
- txt1_username.Text = "";
- txt2_password.Text = "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement