How to connect MySQL database using .NET?

G

Guest

I want to access MySQL database using ADO.NET? I have installed the connector
from MySQL's website, but don't know how to proceed further? Kindly help
 
W

W.G. Ryan eMVP

Just use it like any other IDBProvider object ie

ConnectionType cn = new ConnectionType(connectionString);

CommandType cmd = new Commandtype("SQL Statement", cn);
 
C

Cor Ligthert

Saket,

I see that you did already ask your quesion in this newsgroup as I advised
today in the newsgroup languages.vb.

However because I saw your question in the language.vb newsgroup do I think
that the answer from Bill not brings you much further at this moment.

You got your answers how to connect while probably you are asking how to
use. However the posibilities with dotNet are endless with that, so maybe
you can explain your question something more (is it for a web application, a
windowsform application, what do you want to do)

Cor
 
G

Guest

Cor,

I am developing a Website using ASP.NET with backend on MySQL? As u asked I
am specifying exactly what i need to know

1) Can we connect to MySQL using classes in System.Data.OdbcClient or
System.Data.OledbClient namespace ? Is ODBC or oledb driver available for
MySQL?
2) If we have to use the Connector provided by MySQL, what is the reference
i need to add in the project so that i can access and import
MySQL.Data.MySQLClient namespace?

I hope this clarifies my point.
Thank you for ur help.

Saket Mundra
 
F

Frans Bouma [C# MVP]

Saket said:
Cor,

I am developing a Website using ASP.NET with backend on MySQL? As u asked I
am specifying exactly what i need to know

1) Can we connect to MySQL using classes in System.Data.OdbcClient or
System.Data.OledbClient namespace ? Is ODBC or oledb driver available for
MySQL?
2) If we have to use the Connector provided by MySQL, what is the reference
i need to add in the project so that i can access and import
MySQL.Data.MySQLClient namespace?

ODBC is phased out at microsoft, don't go that route (as it is also
very slow compared to native providers). There are a couple of .NET
providers for MySql. The free ones are all GPL-ed, so if your
application is a commercial application, be aware of this that you then
also have to GPL your software if you use them. MySQL provides one of
them, it's the old ByteFX provider. Another is available at sourceforge,
search for MySQL and .NET, I don't have the url here.

You can also use the commercial provider from Corelab (www.crlab.com).
We use that one and it's very good.

Frans.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top