private void button1_Click(object sender, EventArgs e) { this.Hide(); PBill p = new PBill(); p.Show(); }
private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\M. Hammad Shahid\Documents\Visual Studio 2013\Projects\hotel_management\hotel_management\Database1.mdf;Integrated Security=True"); conn.Open(); string query = "select status from user_account where username='******' and password='******'"; SqlCommand comm = new SqlCommand(query, conn); SqlDataReader rd = comm.ExecuteReader(); if (rd.HasRows == true) { rd.Read(); if (textBox1.Text == "ali123") { this.Hide(); manager_window m = new manager_window(); m.Show(); conn.Close(); } //else if (rd["status"].ToString() == "cashier") //else if (textBox1.Text.ToString() == "amir321") else { this.Hide(); PBill m = new PBill(); m.Show(); conn.Close(); } } else { MessageBox.Show("wrong id or password"); this.Hide(); login l = new login(); l.Show(); conn.Close(); } }