Smoerble
asked on
c#: How to connect to mySQL?
Hi ppl...
I use .NET 1.1. The server is Windows 2003, my dev machine is Win XP.
On both machines the following code is not working:
-------------------
using System.Data.Odbc;
...
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=localhost;" +
"DATABASE=lrforum;" +
"UID=root;" +
"PASSWORD=whatever;" +
"OPTION=3";
OdbcConnection MyConnection = new OdbcConnection(MyConString );
-------------------
error:
Data source name not found and no default driver specified at System.Data.Odbc.OdbcConne ction.Open () at cs.tests.testMySQL.Page_Lo ad...
How can I test if mySQL is installed correctly ?
What is wrong with the code above?
Hope you can help, I am very frustrated right now :(
I use .NET 1.1. The server is Windows 2003, my dev machine is Win XP.
On both machines the following code is not working:
-------------------
using System.Data.Odbc;
...
string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=localhost;" +
"DATABASE=lrforum;" +
"UID=root;" +
"PASSWORD=whatever;" +
"OPTION=3";
OdbcConnection MyConnection = new OdbcConnection(MyConString
-------------------
error:
Data source name not found and no default driver specified at System.Data.Odbc.OdbcConne
How can I test if mySQL is installed correctly ?
What is wrong with the code above?
Hope you can help, I am very frustrated right now :(
To use that code, you would need to install MySQL ODBC first. But actually I would recommend you to start using MySQL .NET Data PRovider
If you want to stick with your code, you need to download and install this http://dev.mysql.com/downloads/connector/odbc/3.51.html. Download the windows version either as .EXE or .MSI.
ASKER
I don't need to stick to my code. But I don't know any other way... Any link where to find MySQL .NET Data PRovider and any link for a tutorial / example code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, the download from Razzie solved it, thanks a LOT.