Erreur Compilation Datagrid
Bonjour,
Voilà j'ai un petit soucis, j'ai fouiner le net à la recherche d'un tuto pour débutant pour le remplissage d'un Datagrid.
Après en avoir trouvé un j'ai codé le remplissage de mon Datagrid comme ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
public void List6(string PN,string SN)
{
string conn= connect.conn();
string PNSN= PN+"_"+SN;
try
{
SqlConnection con = new SqlConnection(conn);
this.con.Open();
SqlDataAdapter Adapt = new SqlDataAdapter();
DataSet GridData = new DataSet();
Requete = "SELECT Date,PlantageBanc,PlantageEquip FROM Preintegration WHERE PNSN='"+PNSN+"'";
Adapt.SelectCommand= new SqlCommand(Requete);
Adapt.Fill(GridData,"Preintegration");
DataView GridDataView = GridData["Preintegration"].DefaultView;
DataGridPreint.DataSource=GridDataView;
this.con.Close();
}
catch(Exception ex)
{
MessageBox.Show("ERREUR List6: " + ex.Message);
}
} |
Mais malheureusement je me retrouve avec une erreur lors de la compilation de mon projet, cet erreur est la suivante :
Citation:
Cannot apply indexing with [] to an expression of type 'System.Data.DataSet' (CS0021)
Il semblerais que ce soit cette ligne :
Code:
DataView GridDataView = GridData["Preintegration"].DefaultView;
qui pose problème mais comme je suis plutôt débutant dans le domaine je sais pas trop à quoi cela correspond et pourquoi j'ai cet erreur.
Qu'est ce qui bloque