Solved

c# connect to mysql databae

Posted on 2010-11-15
3
491 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is "public object" in C#? 3 48
Printing 1 51
Getting error in connectionstring with Excel. 30 35
.NET 2008 VB and C# 6 28
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

832 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