The error message says that your code does not have the necessary permissions to create an OleDbConnection. Things to look into :
- Is your code running from a shared network drive ? Such code never runs with full trust (pre-.NET 4.0). Also look at the Trust settings of your project. (http://msdn.microsoft.com/en-us/library/ wyts434y.aspx) - Try creating an SqlConnection instead of an OleDbConnection. - Is your SQL server instance configured to use Windows authentication? Because the connection string you are using mandates such a configuration to be set at the SQL Server. On May 28, 10:10 am, jt_2009 <[email protected]> wrote: > Hi Thank you cerberus and fruitman. > > I've done the following: > > Private Sub login_button_Click(ByVal sender As System.Object, > ByVal e As System.EventArgs) Handles login_button.Click > > Dim strConnectionString As String = "Provider=SQLOLEDB;Data > Source=SQLSERVER;Integrated Security=SSPI" > Dim objConnection As New OleDbConnection(strConnectionString) > > objConnection.Open() > > but I get the following error at this point: > > An unhandled exception of type 'System.Security.SecurityException' > occurred in System.Data.dll > > Additional information: Request for the permission of type > 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. >
