Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void loginButton_Click(object sender, EventArgs e)
- {
- try
- {
- using (SqlCommand sqlCommand = new SqlCommand("SELECT * from Siteusers where username like @username AND password like @password", myConnection))
- {
- myConnection.Open();
- string userName = uname.Text;
- string passWord = psw.Text;
- sqlCommand.Parameters.AddWithValue("@username", userName);
- sqlCommand.Parameters.AddWithValue("@password", passWord);
- int userCount = (int)sqlCommand.ExecuteScalar();
- if (userCount > 0)
- {
- using (SqlCommand sqlCommand2 = new SqlCommand("SELECT sitePriv from Siteusers where username like @username AND password like @password", myConnection))
- {
- sqlCommand2.Parameters.AddWithValue("@username", userName);
- sqlCommand2.Parameters.AddWithValue("@password", passWord);
- SqlDataReader reader;
- reader = sqlCommand2.ExecuteReader();
- }
- }
- }
- }
- catch (Exception ex)
- {
- myConnection.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement