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 button1_Click(object sender, EventArgs e) { string qur = "Select name from Table1"; SqlDataAdapter sdq = new SqlDataAdapter(qur, con); DataTable dt = new DataTable(); sdq.Fill(dt); Client2 c2 = new Client2(label5.Text); this.Hide(); c2.Show(); }
private void button1_Click(object sender, EventArgs e) { string quer = "Select amount from Table1 where name='" + label9.Text + "'"; SqlDataAdapter sdq = new SqlDataAdapter(quer, con); DataTable dt = new DataTable(); sdq.Fill(dt); Client2 c2 = new Client2(label9.Text); this.Hide(); c2.Show(); }