You have spent a great deal of money and effort to create a custom accounting program in VisualBasic designed to meet some specific needs of your company. You find that some of your users still access your database through other methods such as Microsoft Excel and Query Analyzer, which causes problems with the integrity of your database. How can you fix this problem?

You have spent a great deal of money and effort to create a custom accounting program in VisualBasic designed to meet some specific needs of your company. You find that some of your users still access your database through other methods such as Microsoft Excel and Query Analyzer, which causes problems with the integrity of your database. How can you fix this problem?


Answer: – Create an application role, and grant it the necessary permissions in the database. Then remove any permissions for your users in the database, and hard-code the sp_setapprole stores procedure into your application to activate the role.

(In this case, you need to create an application role and activate it through your VisualBasic code. This will cause SQL Server to see all your users as the application role and grant them all of the rights and permissions of that role.)