Request for the permission of type 'System.Data.Odbc.OdbcPermission.. help needed

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-04-01T05:30:51Z Indexed on 2010/04/01 5:33 UTC
Read the original article Hit count: 512

Filed under:
|
|

I'm getting the following error when trying to connect to a remote mysql server.

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

I've installed the odbc 5.1 driver, and can connect to the database using the Data Sources (ODBC) tool in Control Panel.

However when I try and run my C# scrip to connect, I get the above error.

I've read its something to do with trust levels or something? I don't quite understand what people were talking about though. I went to C:... Framework/v2.0.50727/CONFIG and added to the medium and high trust.config files, but that didn't help..

Can someone help me out here please?

My connection string is

MyConString = "DRIVER={MySQL ODBC 5.1 Driver};" +
                "SERVER=" + m_strHost + ";" +
                "PORT=3306;" +
                "DATABASE=" + m_strDatabase + ";" +
                "UID=" + m_strUserName + ";" +
                "PWD=" + m_strPassword + ";" +
                "OPTION=3;";

© Stack Overflow or respective owner

Related posts about c#

Related posts about odbc