1
Answer

open a new form with different user

oz Fa

oz Fa

8y
445
1

I want to access a same form but with two types of users : user and admin
here is my code :
public void Menu_Load(object sender, EventArgs e)
{
 
cnx.Open();
SqlCommand cmd1 = new SqlCommand("select * from utilisateur where privilege='User' ", cnx);
int a1 = cmd1.ExecuteNonQuery();
cnx.Close();
if (a1!=0)
{
gestionToolStripMenuItem1.Visible = false;
toolStripLabel1.Text = "user";
}
 
cnx.Open();
SqlCommand cmd = new SqlCommand("select * from utilisateur where privilege='Admin' ", cnx);
int a = cmd.ExecuteNonQuery();
cnx.Close();
if (a != 0)
{
gestionToolStripMenuItem1.Visible = true;
toolStripLabel1.Text = "admin";
}
 }
Answers (1)