Problem connecting with mono
Posted by: Jun
Date: September 17, 2006 03:30PM

Hello:

I tried to install mysql-connector-net-1.0.7 to do it working with mono.

I have mysql server with easyphp.

And mono.

I did Gac registration and after I compile with this command:

mcs test.cs -r:System.Data.dll
-r:"C:\Archivos de programa\MySQL\MySQL Connector Net 1.0.7\bin\Mono 1.0\MySql.
Data.dll"

but when I execute the program:

using System;
using System.Data;
using MySql.Data.MySqlClient;

public class Test
{
public static void Main(string[] args)
{
string connectionString =
"Server=localhost;" +
"Database=prueba;" +
"User ID=root;" +
"Password=;" +
"Pooling=false";
IDbConnection dbcon;
dbcon = new MySqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
// requires a table to be created named employee
// with columns firstname and lastname
// such as,
// CREATE TABLE employee (
// firstname varchar(32),
// lastname varchar(32));
string sql =
"SELECT * " +
"FROM prueba1";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
string ID = (string) reader["ID"];
string ArticuloID = (string) reader["ArticuloID"];
Console.WriteLine("Producto: " +
ID + " " + ArticuloID);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
I got this error message:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass
embly 'MySql.Data, Version=1.0.7.30073, Culture=neutral, PublicKeyToken=8e323390
df8d9ed4' or one of its dependencies. El sistema no puede hallar el archivo espe
cificado.
File name: 'MySql.Data, Version=1.0.7.30073, Culture=neutral, PublicKeyToken=8e3
23390df8d9ed4'
at Test.Main(String[] args)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\M
icrosoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure lo
gging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus
ion!EnableLog].

I tried to search through web but there is not much.

Thanks for the help.

Options: ReplyQuote


Subject
Written By
Posted
Problem connecting with mono
September 17, 2006 03:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.