Petr
Petr

Reputation: 7957

Including MySQL Connector/ODBC 5.1 to C# application

I am using System.data.odbc with "Driver={MySQL ODBC 5.1 Driver}" in the connection string. However, I have not realised there is MySQL connector installed on my PC so however I have not referenced it, it doesn work without it. Now I need to distribute it embed in the app. I have downloaded MySQL Connector/ODBC 5.1 files, but with Add reference it says "The file is not accessible...make sure its valid COM.." etc. Thank you

Upvotes: 3

Views: 5014

Answers (3)

Wizatek
Wizatek

Reputation: 1

The only thing u need is Mysql.Data.Dll You don't need to install the complete connector, everything u need is in there. That also counts for the end user, they also only need the dll

Upvotes: 0

LukeH
LukeH

Reputation: 269658

MySQL Connector/ODBC is, as the name suggests, just an ODBC driver for connecting to MySQL. It's not specifically designed for .NET and you can't embed it in your .NET applications in any way. It will need separate installation on any machine where you need to use it.

MySQL Connector/Net is a fully managed ADO.NET provider for MySQL. It's tailor-made for .NET and doesn't require the installation of any other software. It's easy to reference and distribute in your .NET applications, you'll just need to use the System.Data.MySqlClient namespace and objects rather than System.Data.Odbc.

Upvotes: 7

Andomar
Andomar

Reputation: 238296

You can embed the .NET DLL, but not the driver itself. You'll need to install MySQL Connector on every computer that runs your application.

Upvotes: 1

Related Questions