bonjour,
j'ai un listbox avec plusieurs noms et je voudrai insérer ces noms dans une table sur sqlserver.
l'insertion se passe correctement mais sur le champs dans la table je trouve System.Windows.Forms.ListBox+SelectedObjectCollection
voici mon code d'insertion:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
 Try
                'insertion dans le table compteur
                com = New SqlCommand("insert into COMPTEURS(N_ORD_ECO,SOUS_QUART,CIL,QUART,NOM_CLT,AV_ACC,PORTE,RUE,N_CPT_DEPO,N_SERIE,DER_IND_LU,TP_CAL,MAR_DEPO,DATE_DEPO,ANOM,AG)values('" & ComboBox1.SelectedItem & "','" & TextBox1.Text & "','" & Val(TextBox2.Text) & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & Val(TextBox6.Text) & "','" & TextBox7.Text & "','" & Val(TextBox8.Text) & "','" & Val(TextBox9.Text) & "','" & Val(TextBox10.Text) & "','" & Val(TextBox11.Text) & "','" & TextBox12.Text & "','" & d & "','" & ComboBox2.SelectedItem & "','" & ListBox1.SelectedItems.ToString & "');", con)
                com.ExecuteNonQuery()
                MsgBox("Anomalie enregistrée", MsgBoxStyle.OkOnly)
                TextBox13.Text = ""
                TextBox14.Text = ""
                MaskedTextBox1.Text = ""
            Catch ex As Exception
                MsgBox("Erreur d'insertion des données:" & ex.ToString)
            End Try