Database Security

sullyman

Active member
Joined
Nov 11, 2009
Messages
37
Programming Experience
Beginner
Hi folks,

I wish to run an IF statement for a button but i need to allow only users that have read/write access on the SQL Server 2005 database.

e.g.

If User has read/write access, do this
else
do this
end if

Any help appreciated.
Sully
 
Hmm, well you could try this, im only going to do pseuo-code because you always learn better if you atleast half work it out yourself..

Try
ReadfromDatabase(UserID)
Catch
Return "Sorry, invalid access rights"
End try

Try catch statements aren't very efficient, but if you're not looping it then it should be okay for a one off. Or, you could just check if the user has the proper access rights, presuming the user account's access rights are in the database ?

Alternatively, when the user signs in, dim a variable that holds their access rights, like a boolean, or a simple integer. if their access rights are greater than X, then they can use the button, else return an error message. Just a few possible solutions.

Chris.
 
Back
Top