zalman zalman - 7 months ago 53
MySQL Question

Find connection string for connecting to MySQL Server 5.1.50 using OleDbConnection

I am interested how can I find the connection string in order to be able to connect to MySQL Server 5.1.50 using OleDbConnection(C#).

I used this auto generated string (after adding new data source in Visual Studio):

server=localhost;User Id=MyID;password=MyPassword;database=MyDatabase

but I always get the same annoying error saying:

An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

I have tried adding all possible providers but none of them seems to work.


Is there a reason you aren't using the MySQL .NET connector? Anyways, I think you need to add Provider=MySQL Provider; to your connection string.

try this as your connection string:

Provider=MySQL Provider;server=localhost;User Id=MyID;password=MyPassword;database=MyDatabase; 

The MySQL.NET connector fully implements the ADO.NET interface. Every command is identical to using the System.Data.SqlClient namespace.