Salut!
Je travail avec datagrid et j'ai un code qui permet de peupler mon datagrid à l'aide d'une PS. je voulais utiliser une gridview à la place de datagrid j'ai utilisé le même code mais il me génère ni résultat ni message d’erreur .quelqu’un pourrait m’aider ? Merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 public void BindData()
    {
        SqlConnection myConnection = new SqlConnection(ConnectionString);
 
 
        SqlCommand myCommand = new SqlCommand("PS_NV2", myConnection);
        myCommand.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
        DataSet ds = new DataSet();
        myAdapter.Fill(ds, "MaTable");
        myConnection.Open();
        myCommand.ExecuteNonQuery();
        GridView2.DataSource = ds;
        try
        {
            GridView2.DataBind();
        }
        catch
        {
            GridView2.PageIndex = 0;
            GridView2.DataBind();
        }
        myConnection.Close();
 
    }