Connect to MySQL Database

I am reading up on this and cannot seem to get it right.

I am sure there is an oleDB way of connecting to a MySQL Database which is localhost.

can anyway give me any ideas of how to do this.

thanks in advance

LVL 20
Who is Participating?
You need to add the library MySql to your project. Right Click on your project name. Click Add Reference and add the approriate dll.
here is the conncetion string for MySQL:

"Provider=MySQLProv;Data Source=mydb;User Id=UserName;Password=asdasd;"

you can alose checkout out the MySQL Connection strings as

REA_ANDREWAuthor Commented:
Where in that string Can I supply the server as locahost?

Also Can you show me this integrated with the connectionStrings Tab in the config file. as i am a bit rusty of how to write them

thanks very much

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Have a look at this example:

That includes a example project on how to do it with Oledb.
REA_ANDREWAuthor Commented:
I now get this error

Compiler Error Message: CS0246: The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 15:     protected void Page_Load(object sender, EventArgs e)
Line 16:     {
Line 17:         MySql.Data.MySqlClient.MySqlConnection conn;
Line 18:         string myConnectionString;
Line 19:
REA_ANDREWAuthor Commented:
I have done that. in visual Studio. then I ssave it close it down and copy all the files to the server. It then again gives me the error message. Why will it not find it on the server when the bin directory is write there
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.