本文介绍了VS2010中的OLE DB IN C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试建立这样的连接:
OleDbConnection conn =新的OleDbConnection(
提供商= MySqlprov;" +
"DataSource = sql112.freei.me;" +
用户ID =用户;" +
密码=密码;" +
数据库=数据库名称;"
);

但例外是:
"MySqlprov"提供程序未在本地计算机上注册."
请帮助我.

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.

推荐答案


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();


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"


这篇关于VS2010中的OLE DB IN C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:50
查看更多