Windows Forms Listbox

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2006
Posts: 2
Reputation: niks_crasher is an unknown quantity at this point 
Solved Threads: 0
niks_crasher niks_crasher is offline Offline
Newbie Poster

Windows Forms Listbox

 
0
  #1
Nov 7th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Windows Forms Listbox

 
0
  #2
Nov 11th, 2006
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2305 | Replies: 1
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC