We help IT Professionals succeed at work.

.net error when querying database in VB and SQL

Medium Priority
232 Views
Last Modified: 2013-12-25
Hey Everyone,

I am querying certain tables in our database to retrieve info using DataGridView.  I am coding this in Studio 2005.  I am getting an error box popping up saying that

MicroSoft .NET Framework
"Application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework Configuration Tool."

Then a bit further down I get

"Request for the permission of type
"System.Data.SqlClient.SqlClientPremission,SystemData,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"

I am thinking this is probably in my connection string configuration because the db user is the owner of the db, so the permission error is not there I do not believe.

Thanks.
Comment
Watch Question

Commented:
Go to Table>Property>Permission and check you have all the permission like insert update exec select permission for your user
This is not a SQL permissions error, it is a code access permissions error.  
Are you running the app from a shared drive?  Apps run from shared locations do not have permissions by default to run SqlClient code.  Eithe run the app from a local drive or give the app full trust using the .NET Configuration Tool.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thanks Guys,

It was being stored in my documents which is on the network, I moved to my desktop and it works great.  

Thanks again
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.