private void button1_Click(object sender, EventArgs e) { string query = "Select role from Table1 where name='" + textBox1.Text + "' and password='******'"; SqlDataAdapter sda = new SqlDataAdapter(query, sqcon); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { // Admin_Page ad = new Admin_Page(textBox1.Text); // ad.Show(); if (dt.Rows[0][0].ToString() == "admin") { Admin_Page ad = new Admin_Page(textBox1.Text); this.Hide(); ad.Show(); } else { Client2 nw = new Client2(textBox1.Text); this.Hide(); nw.Show(); } } else { MessageBox.Show("invalid character"); } }
private void button4_Click(object sender, EventArgs e) { Admin_Page f1 = new Admin_Page(label12.Text); this.Hide(); f1.Show(); }