Bonjour

je cherche à réaliser une application réalisant des insertions ou des mises à jours dans une base.Alors que la mise à jour fonctionne tres bien, l'insertion elle n'a jamais lieu.
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 protected void Button1_Click(object sender, EventArgs e)
   {
 
 
           SqlConnection Connection = new SqlConnection(strConnexion);
 
 
           Connection.Open();
           SqlCommand command = new SqlCommand(String.Format(@"select b.description,a.city_id
                                                               from cities a
                                                               left outer join (SELECT * FROM cities_lang WHERE language_code='{1}') b
                                                               on a.city_id=b.city_id
                                                               where a.name = '{0}'", TextBox1.Text, DropDownList1.SelectedValue), Connection);
           SqlDataReader reader = command.ExecuteReader();
 
 
 
 
           while (reader.Read())
           {
               if(!reader.IsDBNull(reader.GetOrdinal("description"))){
                   Cache["description"] = reader.GetString(reader.GetOrdinal("description"));
                   TextBox2.Text = Cache["description"].ToString();
               }
 
               Cache["cityID"] = reader.GetInt32(reader.GetOrdinal("city_id"));
           }
           Connection.Close();  
 
   }
 
   protected void Button3_Click(object sender, EventArgs e)
   {
 
           SqlConnection Connection = new SqlConnection(strConnexion);
           Connection.Open();
           SqlCommand command = new SqlCommand(String.Format(@"update cities_lang
                                                               set description = '{0}'
                                                               from cities_lang join cities on cities_lang.city_id=cities.city_id
                                                               where language_code = '{1}' and name='{2}'",
                                                               TextBox2.Text, DropDownList1.SelectedValue, TextBox1.Text), Connection);
 
           SqlCommand command1 = new SqlCommand(String.Format(@"insert into cities_lang(description,city_id,language_code)
                                                              values('{0}','{1}','{2}') ",
                                                              TextBox2.Text, Cache["cityID"], DropDownList1.SelectedValue), Connection);
 
 
           if (Cache["description"] != null)
           {
               int update = command.ExecuteNonQuery();
           }
           else
           {
               int insert = command1.ExecuteNonQuery();
           }
       }

Merci d'avance pour vos réponses