Link to home
Start Free TrialLog in
Avatar of APPIREDDY
APPIREDDY

asked on

CONNECTING TO MYSQL FROM C#

Hi experts,
I want to connect to Mysql through c# using .net enviroinment,
I have downloaded mysql-connecter-net-6.0.3
should i need to download   mysql -odbc driver.

can anybody tell how to access sata from mysql

many thanks
Avatar of zwei
zwei
Flag of Sweden image

You don't have to use the odbc driver. You have to add a reference to the MySQL connector assembly to be able to use it. If you are in visual studio, go to Project -> add refrence and locate MySql.Data and add it. You'll also have to add the proper usings after you've added the reference to your project of course:
using MySql.Data.MySqlClient;

Open in new window

Avatar of APPIREDDY
APPIREDDY

ASKER

I am trying to add the reference MySql.Data, I am able to go to the package mysql-connecter-net-6.0.3\MySql.Data, but i couldn't add the package.
should i need to do anything?
many thanks
You should be able to add by adding it to the reference folder. If you have installed the connector it will appear in the .NET tab. Otherwise locate the dll using the Browse tab.
addref.jpg
browse.jpg
I have downloaded the connecter from mysql website  and installed it but i could not find the dll files
i will try  downloading the connecter once again
If you installed it, it will appear in the first tab of the add reference dialog (after all the Microsoft assemblies):
NET.jpg
I am using visualstudio express edition , even i couldn't find System.Data.OleDB
I'm also using express edition.
yes i have installed the source one
why  even i couldn't locate  System.Data.OleDB
ASKER CERTIFIED SOLUTION
Avatar of zwei
zwei
Flag of Sweden 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 againe installed mysql connecter
now i can referece MySql.Data