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
| DataGridViewRow oDataGridViewRow = new DataGridViewRow();
DataTable dt = new DataTable();
cmd = new SqlCommand("GetOrganizations", cnx); //procedure stocké
cmd.CommandType = CommandType.StoredProcedure;
dta = new SqlDataAdapter(cmd);
dta.Fill(dt);
for (i = 0; i < dt.Rows.Count; i++)
{
id.CellTemplate.Value = dt.Rows[i][0];
nom.CellTemplate.Value = dt.Rows[i][1];
email.CellTemplate.Value = dt.Rows[i][2];
tel.CellTemplate.Value = dt.Rows[i][3];
statut.Value = dt.Rows[i][4];
oDataGridViewRow.Cells.Add(id.CellTemplate); // <== erreur
oDataGridViewRow.Cells.Add(nom.CellTemplate);
oDataGridViewRow.Cells.Add(email.CellTemplate);
oDataGridViewRow.Cells.Add(tel.CellTemplate);
oDataGridViewRow.Cells.Add(statut);
dataGridView1.Rows.Add(oDataGridViewRow);
} |
Partager