Extraction colonne DataSet
Bonjour,
J'ai un DataSet dont j'aimerais extraire une colonne pour remplir une liste déroulante.
Je fais comme ça :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
DataSet DS = new DataSet();
//Fill the DataSet with the rows that are returned.
MyDataAdapter.Fill(DS, "tableCompagnie");
// Initialisation de la liste déroulante des compagnies
string[] tmp_compagnie = new string[DS.Tables["tableCompagnie"].Rows.Count];
for (int i = 0; i < DS.Tables["tableCompagnie"].Rows.Count; i++)
{
tmp_compagnie[i]=DS.Tables["tableCompagnie"].Rows[i]
["COMP_code"].ToString();
compagnie.DataSource = tmp_compagnie;
}
compagnie.DataBind(); |
Je pense qu'il y a plus simple mais je n'arrive pas à le faire directement. Merci de votre aide :)