tags:

views:

45

answers:

0

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 <IPermission class="OdbcPermission" version="1" Unrestricted="true"/> 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;";