Bonjour,
Je n'arrive pas à remplir une grid avec une requete....
Pas d'erreur, mais ma grid reste vide ...
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
26
27
28
29
30
31
32 protected void button_Click(object sender, EventArgs e) { DataTable dt; SqlParameter p = new SqlParameter("@param", SqlDbType.NVarChar, 50); p.Value = az.Text; command.Parameters.Add(p); SqlConnection connec = new SqlConnection(...); SqlCommand command = new SqlCommand("abc", cn); command.CommandType = CommandType.StoredProcedure; dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); try { connec.Open(); da.Fill(dt); list.DataSource = dt; list.DataBind(); } catch () { // ... } finally { if (connec.State != ConnectionState.Closed) { connec.Close(); } } } }
Merci
Partager