Your "pseudocode" is basically correct.
Just when filling in the DataTable, let's give the columns normal names (if you fill in from the database, add AS 'ColumnName' to the query ...) for example:
SELECT somename AS 'Имя' FROM sometable;
Then:
using (MySqlConnection con = new MySqlConnection()) { con.ConnectionString = MSB.ConnectionString; MySqlCommand com = new MySqlCommand(Query, con); DataTable DT = new DataTable(); try { MySqlDataAdapter adr = new MySqlDataAdapter(Query, con); adr.SelectCommand.CommandType = CommandType.Text; adr.Fill(DT); return DT; } catch (Exception e) { Error = e.Message; return null; } }
and then assign the DataTable as the source DataGridVeiw
DataGridVeiw.DataSource = DataTable; DataGridVeiw.Update();
At the same time in the DataGridVeiw column do not need to create.