Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try to make a connection like this:
OleDbConnection conn = new OleDbConnection(
"Provider=MySqlprov;" +
"DataSource=sql112.freei.me;" +
"User id=user;" +
"Password=pass;" +
"Database=db name;"
);

but the exception is:
"The 'MySqlprov' provider is not registered on the local machine."
please help me.
Posted
Comments
yesotaso 13-Jun-11 13:53pm    
Do you have MySQL Connector installed?

This[^] might help.
 
Share this answer
 
Hi Ahmadalli i prepare to use MySQLConnection than using OLEDBConnection when connecting in MYSQL Database.

You can download the mysqlconnector in this [link]

and use this code to connect.

string strMySQLConnection = "server=localhost;user id=UserName;Password=UserPassword;database=DatabaseName;persist security info=False"
MySql.Data.MySqlClient.MySqlConnection msqlConnection msqlConnection = new MySql.Data.MySqlClient.MySqlConnection(strMySQLConnection);
msqlConnection.Open();
 
Share this answer
 
v3
Comments
ahmadalli 14-Jun-11 14:32pm    
I try it but the new error is:"Unable to connect to any of the specified MySQL hosts."
but the host and another things is correct.
and I close my firewall when try it.
what version of .NET framework you are using?
did you put the port number in like this??
string strMySQLConnection = "server=localhost:3306;user id=UserName;Password=UserPassword;

or try this connection string
string strMySQLConnection = "server=localhost:3306;Database=database;Uid=root;Connect Timeout=30;"


and this is the basic Connection string
string strMySQLConnection = "server=localhost;User Id=root;database=database"
 
Share this answer
 
v4
Comments
ahmadalli 15-Jun-11 10:26am    
I'm using MySQL in Linux host in allamehelli.ir students host.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900