I am trying to connect to the MySQL database using this code client_v is the name of the table I want to get data from.
I went through a lot of similar questions here but I really haven't found an answer to this question.
using MySql.Data.MySqlClient;
private void Form1_Load(object sender, EventArgs e) {
try {
string connetionstring = "Server=a029um.forpsi.com;Uid=userlogin;Pwd=userpassword";
string mysql = "SELECT * FROM dbname.cilent_v";
MySqlConnection conn = new MySqlConnection(connetionstring);
MySqlCommand command = new MySqlCommand(mysql, conn);
conn.Open();
MySqlDataAdapter dtb = new MySqlDataAdapter();
dtb.SelectCommand = command;
DataTable dtable = new DataTable();
dtb.Fill(dtable);
dataGridView1.DataSource = dtb;
} catch(Exception ex) {
MessageBox.Show(ex.Message);
}
}
The error it is returning:
Unable to connect to any of the specified MySQL hosts.