I have this 2 datagridview one is in form 2 and the other is in from3. And I have this log in in form 1.
If a user logs in and his position is pharmacist he will then proceed to form2 and datagridview1 should display all the data of my table pharmacy in my database. After that he logged out.
If a new user logged for example the admin he will then proceed to form 3 and datagridview2 should show him data of the list of employees from table employees in my database.
The problem is datagridview2 shows the lists of all the medicines which is the content of my datagridview1.
here is my code
here is my code for my datagridview1
Call main()
sql = "SELECT * FROM PHARMACY"
con.Open()
da = New SqlDataAdapter(sql, con)
cmd = New SqlCommandBuilder(da)
da.Fill(mytable)
MyBind.DataSource = mytable
MyGrid.DataSource = MyBind
con.Close()
and here is my code for my datagridview2
Call main()
con.Open()
sql = "SELECT * FROM ACCOUNTS WHERE ASTATUS = 'Pending' "
da = New SqlDataAdapter(sql, con)
cmd = New SqlCommandBuilder(da)
da.Fill(mytable)
myBind3.DataSource = mytable
myGrid3.DataSource = myBind3
con.close()