When I debug through the code just hangs on connection.Open();
I am using the connector - using MySql.Data.MySqlClient;
Thanks in advance.
string strProvider = "Data Source=" + host + ";Database=" + database + ";User ID=" + user + ";Password=" + password;
MySqlConnection connection = 开发者_StackOverflow社区new MySqlConnection(strProvider);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "select * from products";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int i = 0; i < Reader.FieldCount; i++)
thisrow += Reader.GetValue(i).ToString() + ",";
listBox1.Items.Add(thisrow);
}
connection.Close();
This will help http://www.connectionstrings.com/mysql
You need to change your connection string for MySQL
精彩评论