Search code examples
c#mysqlmysql.data

Diffrence between using `MySql.Data` and `MySql.Data.MySqlClient`


I am trying to connect to a MariaDB server using the MySql.Data.dll. I think it should work since MariaDB is a drop-in replacement for MySQL.

Found a helpful answer here on StackOverflow, however there is one thing that confuses me.

At the very top of his code he or she uses using MySql.Data and using MySql.Data.MySqlClient. Other tutorials I have found only mention the using MySql.Data.

I apologize if the question is silly, but I really want to understand why is he or she using both statements and not just using MySql.Data?


Solution

  • In this question MySqlConnection and MySqlCommand are used so you can remove MySql.Data because both classes are part of the namespace MySql.Data.MySqlClient.

    You could als write MySql.Data.MySqlClient.MySqlConnection and MySql.Data.MySqlClient.MySqlCommand and remove both using statements.