MySQL Connection

R

Roger Cantillo

Hi:
I'm trying to make a connection to a MySQL database, but I keep getting this
error:

System.ArgumentException: Keyword not supported: 'provider'.

This is the code that fails:

objConn = New SqlConnection("Provider=MSDASQL; DRIVER={MySQL ODBC 3.51
Driver}; Server=localhost; UID=root; PWD=; database=helloworld;
Option=16387;PORT=3306;STMT=;")

Any ideas?


Roger
 
R

Richard K Bethell

Roger Cantillo said:
Hi:
I'm trying to make a connection to a MySQL database, but I keep getting this
error:

System.ArgumentException: Keyword not supported: 'provider'.

This is the code that fails:

objConn = New SqlConnection("Provider=MSDASQL; DRIVER={MySQL ODBC 3.51
Driver}; Server=localhost; UID=root; PWD=; database=helloworld;
Option=16387;PORT=3306;STMT=;")

Any ideas?

Many problems here:

1. You can't use the SqlConnection object to connect to an ODBC database.
That object is a SQL Server specific object and can only be used to go to a
SQL Server database.
2. You can't use the ODBC driver directly as an OleDb provider. There is an
OleDb driver for MySQL - you need that, or the native .NET driver.

http://www.mysql.com/articles/dotnet/

R.
 
A

Armin Zingler

Roger Cantillo said:
Hi:
I'm trying to make a connection to a MySQL database, but I keep
getting this error:

System.ArgumentException: Keyword not supported: 'provider'.

This is the code that fails:

objConn = New SqlConnection("Provider=MSDASQL; DRIVER={MySQL ODBC
3.51 Driver}; Server=localhost; UID=root; PWD=;
database=helloworld; Option=16387;PORT=3306;STMT=;")


Use an OleDBConnection instead.

See also: http://www.connectionstrings.com/

Group for ADO.NET related questions:
microsoft.public.dotnet.framework.adonet
 
H

Herfried K. Wagner [MVP]

* "Roger Cantillo said:
I'm trying to make a connection to a MySQL database, but I keep getting this
error:

System.ArgumentException: Keyword not supported: 'provider'.

This is the code that fails:

objConn = New SqlConnection("Provider=MSDASQL; DRIVER={MySQL ODBC 3.51
Driver}; Server=localhost; UID=root; PWD=; database=helloworld;
Option=16387;PORT=3306;STMT=;")

Maybe it's really "not supported", but have a look at
<http://www.connectionstrings.com>. Maybe you want to use an other data
provider:

<http://www.mysql.com/articles/dotnet/#ADO.NET>

dbProvider
<http://www.einfodesigns.com/products.aspx>

MySQLNet
<http://sourceforge.net/projects/mysqlnet>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top