Bonjour!
En exécutant ma page j'ai ce message d'erreur:
"L'objet doit implémenter IConvertible."
quelqu'un pourrait m'aider.
Merci.
Version imprimable
Bonjour!
En exécutant ma page j'ai ce message d'erreur:
"L'objet doit implémenter IConvertible."
quelqu'un pourrait m'aider.
Merci.
Bonjour,
pourrais-tu poster ton code s'il te plait ?
De quel objet s'agit-il ?
voilà :l'erreur est ici: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
25
26
27
28
29
30
31
32 private void BindData() { SqlConnection myConnection = new SqlConnection(ConnectionString); SqlCommand myCommand = new SqlCommand("SP_S1", myConnection); myCommand.Parameters.Add("@CH1", SqlDbType.VarChar, 30).Value = DropDownList1.SelectedItem; myCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds, "TAble1"); myConnection.Open(); myCommand.ExecuteNonQuery(); GridView1.DataSource = ds; try { GridView1.DataBind(); } catch { GridView1.DataBind(); } myConnection.Close(); }
myAdapter.Fill(ds, "TAble1");
D'où vient ton "TAble1" ? Tu devrais pas avoir avant
Code:ds.Tables.Add("TAble1");
J'ai toujours le même message d'erreur meme si j'ajoute
ds.Tables.Add("TAble1");
Keihilin voilà mon code
mais ça me donne ni résultat ni erreur je sais pas pourquoi???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
25
26
27 private void BindData() { try { SqlConnection myConnection = new SqlConnection(ConnectionString); SqlCommand myCommand = new SqlCommand("SP_S1", myConnection); myCommand.Parameters.Add("@ch1", SqlDbType.VarChar, 30).Value = DropDownList1.SelectedItem; myCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds); myConnection.Open(); myCommand.ExecuteNonQuery(); GridView1.DataSource = ds; GridView1.DataBind(); myConnection.Close(); } catch (Exception) { } }
c'est pour cela que j'ai modifié pour tester.
Si non Shiva Skunk j'ai encore le même message .
merci
Je comprends pasCitation:
Keihilin:
try
{
GridView1.DataBind();
}
catch
{
GridView1.DataBind();
}
myConnection.Close();
}
J'espère que ce n'est pas ton vrai code.
En tout cas j'ai encore le message d'erreur :
L'objet doit implémenter IConvertible.
ça marche voilà ce que j'ai fait:
myCommand.Parameters.Add("@ch1", SqlDbType.VarChar, 30).Value
= DropDownList1.SelectedValue;