I read that I have to download this http://dev.mysql.com/downloads/mirror.php?id=13427#mirrors , but it says that I can't install it because I need .NET Framework. I already have 4.0?!
使用此链接,如果您具有VS.NET 2010 http://dev.mysql.com/downloads/connector/net/ ,该链接将起作用
安装程序正在检查.Net 3.5或2.0 mabey =
您应该使用上述位置(http://dev.mysql.com/downloads/connector/net/)上可用的MySQL Connector / Net 6.3.5。
I pieced this together by copy/paste from an existing project then sanitizing it...so it's not been compiled and tested, but you get the idea. So here's some sample code to get you started:
using MySql.Data.Types;
using MySql.Data.MySqlClient;
private void Function()
{
//Set up connection, SqlHost/etc are classwide and declared elsewhere:
MySql connection = new MySqlConnection("SERVER=" + SqlHost + ";DATABASE=" + DatabaseName + ";UID=" + user + ";PASSWORD=" + password + ";pooling=false");
//Setup query:
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "your query here";
//Connect to relation system and execute query:
connection.Open();
Reader = command.ExecuteReader();
while(Reader.Read())
{
MessageBox.Show("here's a row from the query response: " + Reader[0].ToString());
}
//Clean up:
connection.Close();
Reader.Close();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.