Populate CheckedListBox with results of query
Posted on 2008-10-02
I perform a query that can return more than one row. It will look like this:
select fname, lname, city, job, letter, letterdate, letterbody from tblletter where name = 'joe' and letter like '%office%';
When this query returns more than one row i would like to pop up a small form for the user with a single checkedlistboxcontrol, and iterate through the records and populate that checkedlistbox with all of the letter, letterdate, letterbody values (that is, one row in the list box that includes all three values per record). Also, if only one row is returned from the query, then forget the whole exercise...
Also, can someone please tell me what the property is for the SqlDataReader that returns a row count?
Dim conReader2 As New SqlConnection(strConnect)
Dim conString2 As New SqlCommand(FileSQL2, conReader2)
Dim drReader2 As SqlDataReader
drReader2 = conString2.ExecuteReader(CommandBehavior.CloseConnection)