Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Error when using MySql.Data.dll to connect to MySql DB in iOS Xamarin

$
0
0

Hi ,

Im new to Xamarin and mono developments .Im building an iOS app using Xamarin on Macbook Pro and i want to connect to a mysql DB .
so Ive downloaded the MySql connector from the below link :
http://dev.mysql.com/downloads/connector/net/

and then followed the steps in below to install them on the machine :

https://gist.github.com/steenzout/8413214

I referenced the MySql.Data.dll from the path (/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/mono/4.5/MySql.Data.dll)

and added the below code :

MySqlConnectionStringBuilder conn_string = new MySqlConnectionStringBuilder ();
        conn_string.Server = "serverIP";
        conn_string.UserID = "user";
        conn_string.Password = "pssword";
        conn_string.Database = "DBTest";

        MySqlConnection conn = new MySqlConnection(conn_string.ToString());
        conn.Open();
        conn.Close()

When i build the solution ,the build is successful but when I run the solution ,it will give me the following error :

System.TypeLoadException has been thrown
Could not load type 'MySql.Data.MySqlClient.MySqlTrace' from assembly 'MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.

at

conn.Open();

I checked that the server is accessible .

I dont know what is going wrong ,any help will be highly appreciated as Im banging my head against the walls for hours ..


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>