VS2010中的OLE DB IN C# [英] OLE DB IN C# with VS2010
问题描述
我尝试建立这样的连接:
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.
推荐答案
^ ]可能会有所帮助.
This[^] might help.
艾哈迈达利我准备在MySQL数据库中连接时使用MySQLConnection,而不是使用OLEDBConnection.
您可以在此[链接]
中下载mysqlconnector
并使用此代码进行连接.
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();
您使用的是哪个版本的.NET Framework?
你把端口号放进去了吗?
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"
这篇关于VS2010中的OLE DB IN C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!