Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Session["UserName"] = usernameTextBox.Text;
- Session["Password"] = passwordTextBox.Text;
- SqlConnection con = new SqlConnection();
- con.ConnectionString = "Data Source=itksqlexp8; ; Initial Catalog=mmartza_ConservationSchool;Integrated Security=True;Pooling=False";
- //Int32 verify;
- string query1 = "Select * from users where username='" + usernameTextBox.Text + "' and password='" + passwordTextBox.Text + "' ";
- // SqlCommand cmd1 = new SqlCommand(query1, con);
- System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand(query1, con);
- // create a sqldatabase reader which will execute the above command to get the values from sqldatabase
- System.Data.SqlClient.SqlDataReader reader;
- // open a connection with sqldatabase
- con.Open();
- // execute sql command and store a return values in reade
- reader = comm.ExecuteReader();
- // check if reader hase any value then return true otherwise return false
- if (reader.Read())
- Server.Transfer("Homepage.aspx", true);
- else
- errorLabel.Text = "Please enter a valid username and password or create a new account";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement