Solved

CONNECTING TO MYSQL FROM C#

Posted on 2009-05-11
14
284 Views
Last Modified: 2012-08-13
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
Comment
Question by:APPIREDDY
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
  • 2
14 Comments
 
LVL 7

Expert Comment

by:zwei
ID: 24352982
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
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 24353234
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
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 24353240
and another link for mySql Connector 5.2
http://www.codeproject.com/KB/cs/CsharpAndMysql.aspx
0
Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

 

Author Comment

by:APPIREDDY
ID: 24353364
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
 
LVL 7

Expert Comment

by:zwei
ID: 24353798
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
 

Author Comment

by:APPIREDDY
ID: 24354216
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
 
LVL 7

Expert Comment

by:zwei
ID: 24354298
If you installed it, it will appear in the first tab of the add reference dialog (after all the Microsoft assemblies):
NET.jpg
0
 

Author Comment

by:APPIREDDY
ID: 24354361
I am using visualstudio express edition , even i couldn't find System.Data.OleDB
0
 
LVL 7

Expert Comment

by:zwei
ID: 24354445
I'm also using express edition.
0
 
LVL 7

Expert Comment

by:zwei
ID: 24354460
0
 

Author Comment

by:APPIREDDY
ID: 24354487
yes i have installed the source one
0
 

Author Comment

by:APPIREDDY
ID: 24354532
why  even i couldn't locate  System.Data.OleDB
0
 
LVL 7

Accepted Solution

by:
zwei earned 500 total points
ID: 24354645
Install the
"Windows Binaries (ZIP)" package instead of the sources.
0
 

Author Comment

by:APPIREDDY
ID: 24354786
I have againe installed mysql connecter
now i can referece MySql.Data
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question