Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- ProjectFunc loginF = new ProjectFunc();
- loginF.GetId(username, password);
- if(loginF.Userid == 0)
- {
- MessageBox.Show("Wrong username and/or password, try again.");
- }
- else
- {
- this.Hide();
- }
- username_txt.Clear();
- password_txt.Clear();
- catch (Exception ex)
- {
- MessageBox.Show("Could not connect to DB" + ex);
- }
- public void GetId(string username, string password)
- {
- using (var con = new SqlConnection(myCon))
- {
- con.Open();
- using (var cmd =new SqlCommand("Select userid from Login, UserLogin where Login.loginid = UserLogin.loginid and username = '" + username + "' and password = '" + password + "' ;", con);
- {
- using (var reader = cmd.ExecuteReader())
- {
- while (reader.Read())
- {
- userId = (int)reader[0];
- Main menu = new Main();
- menu.Show();
- }
- }
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- } // 5 buttons totally, nothing else so far.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement