With this class, you can ensure that the current process has the required security level to access the OLE DB .NET provider before you attempt to open a connection. If it doesn’t, a System.Security.SecurityException will be thrown. You can also use this class to programmatically revoke the permission to access the OLE DB .NET provider for the current method call.

Note that this class pertains only to code access security (the policy of allowed and disallowed actions you have configured using the .NET Framework Configuration Tool or the caspol.exe command-line utility). For more information, refer to the reference for the base class System.Data.Common.DBDataPermission. Currently, there are only two additional restrictions you can impose: denying the right to use blank passwords in a connection string and restricting the allowed OLE DB drivers.

public sealed class OleDbPermission : System.Data.Common.DBDataPermission {

// Public Constructors

   public OleDbPermission( );  

   public OleDbPermission(System.Security.Permissions.PermissionState state);

   public OleDbPermission(System.Security.Permissions.PermissionState state, 

      bool allowBlankPassword);

// Public Instance Properties

   public string Provider{set; get; } 

// Public Instance Methods

   public override IPermission Copy( );              // overrides System.Data.Common.DBDataPermission

   public override void FromXml(System.Security.SecurityElement securityElement);

                             // overrides System.Data.Common.DBDataPermission public override ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.