Click here to Skip to main content
13,146,402 members (54,095 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I want to store and retrieve users added to sql database using c#(Winforms) . When a user logs in to the application (C#), controls will be enabled/disabled/visible/hidden based on the role that the user has been added to and, logs will be stored when the user accesses a stored procedure, view or functions. My question is: Do I need to create a database user(sql database user) for each user name (using a single login name)
when the user of the c# application add a new user or do i create a database table and add users to it (using single login name and user name to sql database and server)?

What I have tried:

i do not know which option is suitable.
Posted 13-Sep-17 8:02am
Updated 14-Sep-17 4:33am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

No, your app is the SQL User, the actual users should be stored in a table which is accessed via the single SQL User. You add and remove users (and their roles) to that table.

(If you think about it, that's the only sensible way to go, to create a user in SQL from your code, you'd need to connect to SQL - which requires a user with the right permissions.)
  Permalink  
Comments
kwaku Emma 13-Sep-17 15:32pm
   
how do I make log entries when user accesses stored procedures?
OriginalGriff 14-Sep-17 4:51am
   
Do you want to try explaining that, assuming that I can't see your screen, access your HDD, or read your mind? :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 14 Sep 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100