1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
data = new DataTable();
MySqlDataReader rd;
dataGrid.RowHeadersVisible = true;
dataGrid.AllowSorting = false;
MySqlCommand comm = new MySqlCommand(ma_command, ma_connexion);
rd = comm.ExecuteReader();
string [] save = new string[100];
int b = 0
while (rd.Read() )
{
elem = .......(rd[2].ToString());
save[b] = rd[7].ToString() ;
my_table.Columns.Add(rd[7].ToString() );
b++;
}
for (int a = 1 ; a < 100 ; a++)
{
DataRow my_row;
my_row = my_table.NewRow();
for (int c = 0; c < b; c++)
{
my_row[save[c]] = " ";
}
my_table.Rows.Add( my_row);
}
dataGrid.DataSource = my_table;
} |
Partager