Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'System.Data.SqlClient' error

Status
Not open for further replies.

kimprogrammer

Programmer
Sep 15, 2008
160
CA
Hello
I'm new to vb and was wondering if anyone could help me.
I have been writing my project and and debugging for a while with no problems then I got the following error pointing to my first table adapter.

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


It was working previously and I've made no changes. If I try a different form in the project the first table adapter it gets the same error.

I have full trust and when I test the connection it is ok.


When I seach for this error online - people who have encountered it are opening the connection in the code which is not what I'm doing.

I would appreciate any help.
 
Is the project located on your computer or on a different computer on the network? Can you successfully connect to your database anywhere else in your project?

Andrea
 
The project is on our networks f: drive. I had this error when I first started out and had the project on my laptop drive. And resolved it by moving it to the network.

So this started after I had already been working with forms and was doing testing on my input screen.
The other forms give me the same problem on the first tableadapter I come to - if I comment it out it will then give me the same error on the next tableadapter.

If I go into the tableadapter and select preview data - the data comes up.

In the project properties the user id and passwords are correct - and when I check the connection it is say it connects.




 
I normally see that error when the client does not have full trust to the network location.

Andrea
 
I do have it set up as full trust application in the security page of the properties. It was not not accidently changed. That was the first thing I checked.
 
Finally resolved by creating a new project included my forms from the old project and it debugged with no problem. So even though everthing did look ok there must have been something that could not be seen causing this.
 
In the end this is how it finally was resolved.

In the .Net configuration

Open Control Panel >> Administrative Tools
Select Microsoft .NET Framework 2.0 Configuration
Expand My Computer > Runtime Security Policy

Expand Machine > Code Groups > All Code
Select “Edit Code Group Properties”
On the Permission Sets tab change it to Everything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top