MySQL Forums :: Connector/NET and C#, Mono, .Net :: Using MySQL in C# (libraries)

Advanced Search

Using MySQL in C# (libraries)
Posted by: Gerhard Mayer ()
Date: March 04, 2006 08:06AM


I'm new to using Microsoft .NET and C#.
I tried to connect to a MySql database (version 5) via MySQL Connector/NET

Here is my code snippet:

public void MYSQL_Connect()
MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;

myConnectionString = "server=;uid=root;" +

conn = new MySql.Data.MySqlClient.MySqlConnection();
conn.ConnectionString = myConnectionString;
catch (MySql.Data.MySqlClient.MySqlException ex)
} // MYSQL_Connect

I got the error message:
"The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)"

Then I inserted the following line at the beginning:
using MySql::Data;

Now the compiler says:
"Alias 'MySql' not found"

How can I tell the C# compiler to know the MySQL libraries?

Hope someone can help me and give some useful hints.

Thanks in advance.

G. Mayer

Options: ReplyQuote

Subject Written By Posted
Using MySQL in C# (libraries) Gerhard Mayer 03/04/2006 08:06AM
Re: Using MySQL in C# (libraries) Thompson Tang 03/06/2006 02:10AM

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.