Friday, March 9, 2012

Help w/ SqlClientPermission

Hello!

I'm currently working on a project consisting in rewriting VB 6.0 applications into VS 2005 applications. I already have the form designed in VS '05 w/ the controls, and I'm connected to a SQL server 2000 database. I've also created the different data adapters and datasets, which in VS 2005, have also created BindingSources and BindingNavigators. But, when I run the project, I am getting the following error, and the form doesn't appear:

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

I have been trying to find ways to get around it, but I'm not that successful. I have gone online on the Microsoft website and found a host of comments from other people, but I can't relate theirs to my problem. I understand that my program needs to be granted this permission for it to run, but I can't seem to know what and where to begin resolving it. Here's also what I've found online about how to resolve it:

To grant the required permissions to a custom assembly, follow these steps:

1. Assert permissions in your custom assembly.

2. Make the custom assembly available to your project.

3. Reference the custom assembly in your project.

4. Modify the code access security (CAS) settings for your custom assembly.

Can anyone who has encountered this kind of error tell me if these are the steps I need to take to solve it?

Also, is teh custom assembly the AssemblyInfo.vb file or is it obtained by right-clicking the project in the Solution Explorer and pointing at the properties?

Thanks very much for any help I can help.

Have a wonderful day.

This is a CAS policy which could be set at domain level and enherited by your computer. The SQLClient assembly is not rated as trusted in the domain/Area you want to run the application (either locally or over the network which is in common not allowed / trusted). YOu can see the configured permissions using the .Net Framework configuration tool.

Jens K. Suessmeyer

http://www.sqlserver2005.de

No comments:

Post a Comment