Hey guys, recently I’ve been trying to implement mySQL with C# and I could done some nice things like add new values into tables of my database via C# script inside my project. The problem is that when I build the project as .exe mySQL integration don’t work properly. When I checked out the output log I figured out this error:
(Filename: Line: -1)
TypeLoadException: Could not load type 'MySql.Data.MySqlClient.MySqlConnection' from assembly 'MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
What that error means? How can I fix it? The MySQL part in my script is the following:
void Start () {
string connectionString = "Server=localhost;" + "Database=cadastro;" + "User ID=root;" +
"Password=mypass;" + "Pooling=false";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();
MySqlCommand dbcmd = dbcon.CreateCommand();
string newCommand = ("INSERT INTO login VALUES (" + 1 + ", 'newuser', 'newpassword');");
dbcmd.CommandText = newCommand;
}
IMPORTANT : My script’s using MySql.Data.MySqlClient; and the file is in my Assets folder.