Link to home
Start Free TrialLog in
Avatar of REA_ANDREW
REA_ANDREWFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

Andy
Avatar of Arthur_Wood
Arthur_Wood
Flag of United States of America image

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

http://www.connectionstrings.com/

AW
Avatar of REA_ANDREW

ASKER

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

Andy
Have a look at this example: http://www.csharphelp.com/archives2/archive288.html

That includes a example project on how to do it with Oledb.
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:
 
ASKER CERTIFIED SOLUTION
Avatar of existenz2
existenz2
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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