View Single Post
  #2 (permalink)  
Old January 19th, 2015, 06:11 PM
Rod Stephens's Avatar
Rod Stephens Rod Stephens is offline
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: , , .
Posts: 641
Thanks: 2
Thanked 96 Times in 95 Posts

Sorry for the slow reply.

It looks like that code loops through the records and displays them one at a time in the TextBoxes. It all happens too fast to see and you only see the last values they contain from the final record.

One solution would be to add the results to a ListBox or ComboBox. Suppose you have a ListBox named lstResults. Then the key piece of code might look something like this:

While dr.Read()
    String result = dr("CD").ToString() & _
        dr("ARTISTS").ToString() & _
        dr("RECORDED").ToString() & _
        dr("TUNE").ToString() & _
End While
The same would work for a ComboBox.

You could also move the values into a DataGrid or other control one at a time, but it would be easier to use LINQ To SQL to load the data into a DataTable and then set the DataGrid's DataSource property to the DataTable. (If I'm remembering correctly.)

Give one of these ideas a try and if it doesn't work email me ( and I'll help you out.

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
The Following User Says Thank You to Rod Stephens For This Useful Post:
bobwhite (January 20th, 2015)