I am doing simple Console Application, trying to connect to database and then to print records... whatever...
I am failing to connect to database.
I am sure my code is correct, and my connection string is right. I copied it from "Server Explorer" properties where I am successfully seeing all the tables and fields.
I was googling this question and I figured it's about granting permission to my app to access sql server? Microsoft is suggesting to use permview.exe, but they for some reason think we all know where it is an how to use it. I couldn't find it on my machine. And, then... why would I need to set permissions if I am providing login and pass in my connection string? this is doesn't have any sense to me. I have VS2005.
Please somebody help me with this.
here is my code:
This is the error message:
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
I am failing to connect to database.
I am sure my code is correct, and my connection string is right. I copied it from "Server Explorer" properties where I am successfully seeing all the tables and fields.
I was googling this question and I figured it's about granting permission to my app to access sql server? Microsoft is suggesting to use permview.exe, but they for some reason think we all know where it is an how to use it. I couldn't find it on my machine. And, then... why would I need to set permissions if I am providing login and pass in my connection string? this is doesn't have any sense to me. I have VS2005.
Please somebody help me with this.
here is my code:
Code:
string ConnectionString = @"Network Library=DBMSSOCN;Data Source=servername;Initial Catalog=dbtest;User ID=xxx;Password=xxx;";
SqlConnection thisConnection = new SqlConnection(ConnectionString);
thisConnection.Open(); //it fails here
....
This is the error message:
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.