Ecco il codice. Ho trovato un esempio di codice, solo che usa i comandi sql.
codice:
string q = "QUERY";
string connectionString = "Data Source=172.0.0.1;Initial Catalog=prova;User Id=root;Password=;";
SqlConnection cn = new SqlConnection(connectionString);
SqlCommand cm = new SqlCommand(q, cn);
SqlDataReader dr;
DataTable dt = new DataTable();
cm.CommandType = CommandType.Text;
try
{
cm.Connection.Open();
dr = cm.ExecuteReader();
if (dr.HasRows)
dt.Load(dr);
dataGridView1.DataSource = dt;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
esce un errore di collegamento al server. Sapete come aiutarmi?