private void button3_Click(object sender, EventArgs e) { pharlog obj = new pharlog(); this.Hide(); obj.Show(); }
public void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Contains("A")) { phrm = "admin"; } else { phrm = "login"; } string con = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Database\HMS.mdf;Integrated Security=True;Connect Timeout=30"; string qry = "SELECT * From login WHERE username = '******' and password = '******'"; SqlDataAdapter adp = new SqlDataAdapter(qry, con); DataTable tb = new DataTable(); adp.Fill(tb); if (tb.Rows.Count == 1 && textBox1.Text.Contains("D") && textBox1.Text.Length == 4) { drlog obj = new drlog(); this.Hide(); obj.Show(); } else if (tb.Rows.Count == 1 && textBox1.Text.Contains("P") && textBox1.Text.Length == 3) { phrm = "p"; pharlog obj = new pharlog(); this.Hide(); obj.Show(); } else if (tb.Rows.Count == 1 && textBox1.Text.Contains("A") && textBox1.Text.Length == 2) { Adminlog obj = new Adminlog(); this.Hide(); obj.Show(); } else if (tb.Rows.Count == 1 && textBox1.Text.Contains("R") && textBox1.Text.Length == 3) { PatientDB obj = new PatientDB(); this.Hide(); obj.Show(); } else { MessageBox.Show("Invalid Username or Password"); } }