C# – Provider needed to be specify on a connectionstring

cconnection-stringdatabasesql

I have a very funny problem on my application, I get an error as follow:
System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

However, when I tried to speicify the provider on my connection as Provider=SQLOLEDB.1 or Provider=SQLOLEDB, then I get another error saying invalid keyword 'Provider'.

But one thing I noticed, the computer that I am targeting to had 2 different database system, will that cause this error?

Any idea how to solve this problem?

Regards

Best Answer

Assuming that you are using ADO.NET, if you want to use distinct database systems, then you need to correct the DbConnection too, not only the connection string.

Note that you can't use an SqlConnection for OLEDB, you need to use System.Data.OleDb.OleDbConnection instead.

Related Topic