For i = 1 To ListBox1.Items.Count - 1
cstr1 = ListBox1.Text
strqry1 = "insert into trans(pid) values('" & cstr1 & "')"
MessageBox.Show(strqry1)
If ListBox1.GetSelected(i) = True Then
cmd.CommandText = strqry1
cmd.ExecuteNonQuery()
End If
Next
MessageBox.Show("Records added")
the above code is for inserting multiple records frm listbox to table
but ony the first record gets added
needed help