Solved

c# connect to mysql databae

Posted on 2010-11-15
3
496 Views
Last Modified: 2012-06-21
How many method that c# connect to my sql  odbc , .net and what is the difference
0
Comment
Question by:teera
[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
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34135961
I believe this is what you are asking:

To connect to MySql, you can use either ODBC, OLEDB, or the .NET connector. The difference between the two is how they connect and interact with the database.

ODBC is the oldest of the technologies. If I recall correctly, it is the most generic of the the three and was designed to be able to connect to the various DBs of the time. Because of its genericness, it is the least efficient.

I don't know much about OLEDB except that it is a successor to ODBC and I believe it slightly outperforms ODBC.

The .NET connector for a DB is usually coded by the maintainer of the DB itself, and therefore is typically the best performing of the three.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 34135962
>>  The difference between the two

The difference between the THREE   :)
0
 
LVL 10

Expert Comment

by:GlobaLevel
ID: 34155436
ADO.NET is the best and allows you to create mulitple join statements, whereas ODBC, and OLEDB you can only hit one table at a time...

Plus with ADO.NET you have use of parameters which prevents SQL injection and the dataaptor lets you easily find data that you just quried....its really a step up...

example of parameters to prevent sql injection

Dim SQLstring As String = "SELECT * FROM PRODUCT p Join customer c ON  c.id = p.id WHERE WxxD = @var_xxIxt_ID AND 1 = 1"

 Using command As New SqlCommand(SQLstring, sqlConn)
    command.Parameters.Add(New SqlParameter("@var_xxIxt_ID", SqlDbType.Int)).Value = var_xxIxT_ID
    dataReader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
    If dataReader.HasRows Then
        Do While dataReader.Read()


with the old stuff I would add " AND 1 = 1 " as a trick to prevent sql injection...
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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