Good night
I would like to know how i can do to insert in a table of mysql some itens that i select in a Checkedlistbox.
But the Checkedlistbox as very itens.
Private Sub btnguardar3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnguardar3.Click
Dim data_adapter As Odbc.OdbcDataAdapter
Dim data_table As New DataTable
Dim i As Integer
Dim j As Integer
Dim nome As String
Call ligar()
i = 0
For i = 0 To CheckedListBox1.CheckedItems.Count - 1
nome = CheckedListBox1.GetItemText(CheckedListBox1.SelectedItems.Item(i))
data_adapter = New Odbc.OdbcDataAdapter("select id_disc from disciplinas where disc_nome = '" & nome & "'", con)
data_adapter.Fill(data_table)
i = data_table.Rows(j).Item(0)
cmd.CommandText = "insert into disciplinas_alunos (numero_mec,id_disc) values ('" & Me.txtnumero.Text & "','" & i & "')"
cmd.ExecuteNonQuery()
Next
End Sub
this is the code that is gives me :'( because if i select only one it put it in the table but if i select two or more it's continous to put only one... i don't undestand.
sorry for my english...