Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

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
0
REA_ANDREW
Asked:
REA_ANDREW
  • 3
  • 2
1 Solution
 
Arthur_WoodCommented:
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
0
 
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

Andy
0
 
existenz2Commented:
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:
 
0
 
existenz2Commented:
You need to add the library MySql to your project. Right Click on your project name. Click Add Reference and add the approriate dll.
0
 
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now