[Mono-list] newbie:help connecting with nysql 5.0

Florian Hester florian at nedlinux.nl
Mon Jul 2 07:41:36 EDT 2007


Hello,

Try putting the MySql Connector DLL's in a bin directory in same directory
as your page.

If that does not work, here is a link to the 1.0.7 version of the connector:

http://ftp.snt.utwente.nl/pub/software/mysql/Downloads/Connector-Net/mysql-connector-net-1.0.7.zip

Florian Hester

> hello there,       I have just got started
> with mono and having a trouble connecting with Mysql 5.0..It seems it
> can\'t find the driver needed.I have mysql connector/.net 1.0.9....but
> can\'t get that working.I read somewhere mono needs 1.0.7 of that
> connector ,but I can\'t find that version anywhere.Can anyone please tell
> me which driver to use and a sample code snippet to connect to mysql.Now I
> am using the sample snippet given in the MONO official site
> :-****************************************************************************************using
> MySql.Data.MySqlClient;using MySql.Data;public class Default :
> Page    {       
>         public virtual void
> onButtonClick(object sender, EventArgs e)   
>     {       
>     string connectionString =\"Server=localhost;\" +
> \"Database=test;\" + \"User ID=root;
>  \" + \"Password=mysql;\" +
> \"Pooling=false\";       IDbConnection
> dbcon;       dbcon = new
> MySqlConnection(connectionString);      
> dbcon.Open();       IDbCommand dbcmd =
> dbcon.CreateCommand();     
>        string sql
> =           \"SELECT
> name, age \" + \"FROM table1\";      
> dbcmd.CommandText = sql;       IDataReader
> reader = dbcmd.ExecuteReader();      
> while(reader.Read())
> {           
> string name = (string)
> reader[\"name\"];           
> string age = (string)
> reader[\"age\"];           
> Response.Write(\
>  "Name :- \"+name+\"Age :- \"+age);      
> }       // clean
> up      
> reader.Close();       reader =
> null;      
> dbcmd.Dispose();       dbcmd =
> null;      
> dbcon.Close();       dbcon =
> null;           
> Response.Write(\"Hello\");       
>            
> }   
> }*******************************************************************************************and
> the error I am getting now is
> :-#################################################################################[Task:File=/home/rupanupal/Projects/NewTest/NewTest/Default.aspx.cs,
> Line=26, Column=20, Type=Error, Priority=Normal, Description=The type or
> namespace nam
>  e `MySqlConnection\' could not be found. Are you missing a using
> directive or an assembly
> reference?(CS0246)]###################################################################################I
> have the above two references already added.What might be the
> issue???Please suggest a way.Thanking you all...R.
> Pal_______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>




More information about the Mono-list mailing list