Sir/Ma'am,
I have a checkedlistbox and listbox in a window form, when i check the items that i want to search in a database in the checkedlistbox it will add to the listbox. My question is how can i pass the items in my query in order to search the particular fields in a database table.

dim s as string
s = "SELECT '" & listBox1.Items(Me.listBox1.SelectedIndex).ItemData().ToString() & "' from tablename "

Thank you for prompt response.

nikki

Hi,

Dim i As Long
Dim sSQL As String
sSQL = ""
For i = 0 To lstSel.Items.Count-1
If i = 0 Then
sSQL = lstSel.Items(i).ToString
Else
sSQL = sSql & "," & lstSel.Items(i).ToString
End If
Next

Ur Query String will be

s = "SELECT '" & sSQL & " from tablename "


Regards
Veena