Greetings i have a feature i want to add to my program which is hiding and displaying rows depending on the user role that logged onto the application
for example (all user data are in MySql database)
if a person with the "Sales" role logged into the application He will not see the quantity row in the datagridviewer
if a person with the "Warehouse Manager" role logged into the application he can see everything in the datagridviewer
but unfortunately i dont know the correct code to user here
my thought the code will be put in form load but iam missing the code it self
Thank you.
CodePudding user response:
A good solution would be to manually populate the datagridview and check the role of users at the same time. While populating the datagridview, check if the logged-in user is in "Sales", skip this line of code: DataGridView.Rows.Add(...).
note: For large amount of records a better solution would be to filter data based on the roles, in SQL query level.
