• subscribe
May 23, 2001 12:00 AM

VB Data Environments and Application Roles

SQL Server Pro
InstantDoc ID #20535

You can use application roles in a Visual Basic (VB) Data Environment. To avoid resource-pooling problems, include the OLE DB Services = -2 option in the Connection object's ConnectionSource property. When you define the connection in the Data Environment UI, the dialog box has nowhere to enter the OLE DB Services option. However, you can add the extra text manually in the ConnectionSource property's connection string. The following example shows a completed ConnectionSource that uses Windows 2000/Windows NT authentication against a local server:

Provider=SQLOLEDB.1;Integrated Security=SSPI;OLE DB Services = -2;Persist
Security Info=False;Initial Catalog=Products;Data Source=(local

You can execute the sp_setapprole stored procedure in a Data Environment Connection object's ConnectionComplete event. This stored procedure activates the application role as soon as the connection is open, and the application role remains active as long as the connection endures. Figure A shows an example of how to use a Data Environment connection's ConnectComplete event procedure to execute the sp_setapprole stored procedure and activate the application role. After the stored procedure activates the application role, any Command and Recordset objects that the Connection object creates execute within the application role's security context.



ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...