Improve company productivity with a Business Account.Sign Up

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

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
0
APPIREDDY
Asked:
APPIREDDY
  • 6
  • 6
  • 2
1 Solution
 
zweiSoftware DeveloperCommented:
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

0
 
Anurag ThakurTechnical ManagerCommented:
the following link shows how to connect to MySql using OleDb
http://www.aspfree.com/c/a/Database/Database-Programming-in-C-Sharp-with-MySQL-Using-OleDB/
0
 
Anurag ThakurTechnical ManagerCommented:
and another link for mySql Connector 5.2
http://www.codeproject.com/KB/cs/CsharpAndMysql.aspx
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
APPIREDDYAuthor Commented:
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
0
 
zweiSoftware DeveloperCommented:
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
0
 
APPIREDDYAuthor Commented:
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
0
 
zweiSoftware DeveloperCommented:
If you installed it, it will appear in the first tab of the add reference dialog (after all the Microsoft assemblies):
NET.jpg
0
 
APPIREDDYAuthor Commented:
I am using visualstudio express edition , even i couldn't find System.Data.OleDB
0
 
zweiSoftware DeveloperCommented:
I'm also using express edition.
0
 
zweiSoftware DeveloperCommented:
0
 
APPIREDDYAuthor Commented:
yes i have installed the source one
0
 
APPIREDDYAuthor Commented:
why  even i couldn't locate  System.Data.OleDB
0
 
zweiSoftware DeveloperCommented:
Install the
"Windows Binaries (ZIP)" package instead of the sources.
0
 
APPIREDDYAuthor Commented:
I have againe installed mysql connecter
now i can referece MySql.Data
0
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.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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