Need help:
I am doing simple Console Application, trying to connect to database and then to print records... whatever...
I am failing to connect to database.
There is some example here: basically they suggest to use "Server=ComputerName, PortNumber", but anyway, the whole thing doesn't work. (not first time dough...)
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 doesn't have any sense to me. I have VS 2005 installed.
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 doing simple Console Application, trying to connect to database and then to print records... whatever...
I am failing to connect to database.
There is some example here: basically they suggest to use "Server=ComputerName, PortNumber", but anyway, the whole thing doesn't work. (not first time dough...)
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 doesn't have any sense to me. I have VS 2005 installed.
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.