private void btn_total_Back_Click(object sender, EventArgs e) { this.Hide(); DashBoard ds1 = new DashBoard(); ds1.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { // string query = "select * from userlogin where userid = '" + this.txtusername.Text + "' and password = '******';"; SqlConnection sqlcon = new SqlConnection(@"Data Source=DESKTOP-Q8D5FNB;Initial Catalog=resturent;Integrated Security=True"); SqlCommand cmd = new SqlCommand("select * from userlogin where userid = '" + this.txtusername.Text + "' and password = '******';", sqlcon); //sqlcon.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); // SqlCommand sqlcom = new SqlCommand(query, sqlcon); DataTable dt = new DataTable(); sda.Fill(dt); { string itm = choose_user.SelectedItem.ToString(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["usertype"].ToString() == itm) { MessageBox.Show("Your Arelog in as " + dt.Rows[i][1]); if (choose_user.SelectedIndex == 0) { DashBoard dss = new DashBoard(); dss.Show(); this.Hide(); } else { Employee_DashBoard emd = new Employee_DashBoard(); emd.Show(); this.Hide(); } } } } else { MessageBox.Show("Login Invalid"); sqlcon.Close(); } } }