Security Reusable Code: VBSEC

VBSEC is a Visual Basic library that provides an easy method of inquiring whether or not a user has execute privileges on a particular SQL Server stored procedure. It requires the use of VBODBC and the sp_security stored procedure.

Files

1. VBSEC.BAS Visual Basic module

2. VBSEC.SQL SQL Server sp_security stored procedure script

Function APIs

1. VBSEC_InitSecurity() - Retrieves from the server, with sp_security, a list of stored procedures that the current VBODBC user connection can execute.

2. VBSEC_ExecSecurity() - Given a stored procedure name, returns true if the current VBODBC database connection is able to execute it.

Instructions

1. Add VBSEC.BAS to your project.

2. Follow the instructions earlier in this presentation and add the VBODBC files to your project.

3. Have the Visual Basic application connect to a data source.

4. Make sure the stored procedure sp_security has been installed in the data source's database.

5. Call VBSEC_InitSecurity to initialize security and receive server stored procedure security parameters.

6. Call VBSEC_ExecSecurity whenever the application needs to determine whether the database connection has execute privileges on a stored procedure.