Compila Datagridview con dati MySQL

ho provato diverse volte a farlo funzionare ma non riempie la vista dati con i dati mysql, ecco il mio codice:

string connectionString = "SERVER=localhost;DATABASE=shootsource;UID=root;PASSWORD=;"; string sql = "SELECT * FROM characters"; MySqlConnection connection = new MySqlConnection(connectionString); connection.Open(); sCommand = new MySqlCommand(sql, connection); sAdapter = new MySqlDataAdapter(sCommand); sBuilder = new MySqlCommandBuilder(sAdapter); sDs = new DataSet(); sAdapter.Fill(sDs, "characters"); sTable = sDs.Tables["characters"]; connection.Close(); dataGridView1.DataSource = sDs.Tables["characters"]; dataGridView1.ReadOnly = true; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; 

Mostra solo le colonne della tabella mysql ‘caratteri’: id, nome, ora ecc … come posso popolarlo dal db?

Ecco un’immagine del problema:

inserisci la descrizione dell'immagine qui

  private void MySQL_ToDatagridview() { //VarribleKeeper.MySQLConnectionString = your connection string //info being your table name MySqlConnection mysqlCon = new MySqlConnection(VarribleKeeper.MySQLConnectionString); mysqlCon.Open(); MySqlDataAdapter MyDA = new MySqlDataAdapter(); string sqlSelectAll = "SELECT * from info"; MyDA.SelectCommand = new MySqlCommand(sqlSelectAll, mysqlCon); DataTable table = new DataTable(); MyDA.Fill(table); BindingSource bSource = new BindingSource(); bSource.DataSource = table; dataGridView1.DataSource = bSource; } 

Dopo aver impostato il DataSource, devi creare un DataBind

 dataGridView1.DataBind();