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
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cn.Open()
Dim dt As New DataTable
Dim da As New OleDbDataAdapter
Dim x, z As Integer
Dim cmd As New OleDbCommand("INSERT INTO tab_asso(id_dossier,denomination,date_recep,nom_prenom,adresse,wilaya,code_wilaya,region,pieces_fourni,pieces_manquant) values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & DateTimePicker1.Value.Date & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & ComboBox1.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & CheckedListBox1.Items(x).ToString & ",""',""' , '" & CheckedListBox1.Items(z).ToString & "' ", cn)
cmd.Connection = cn
da = New OleDbDataAdapter(cmd)
da.Fill(dt)
CheckedListBox1.DataSource = dt
CheckedListBox1.DisplayMember = "dossier_ass"
CheckedListBox1.ValueMember = "DESIGNATIONS"
CheckedListBox1.Text = ""
cmd.CommandType = CommandType.Text
For i = 0 To CheckedListBox1.Items.Count - 1
If CheckedListBox1.GetItemChecked(i) = True Then
i = x
Else
i = z
End If
Next
cmd.ExecuteNonQuery()
MessageBox.Show("Data inserted successfuly")
cn.Close()
End Sub |
Partager