Re: How to fill a List(Of )
have a search for
SqlConnection
SqlCommand
SqlDataReader
when you're able to fill a sqlDataReader with the book data, you will be able to cycle thorugh records to load items of a List Of.
And while loading items of the list of books, you will also be able to query the db again to retrieve a sqlDataReader
full of chapters for the book you're on and to load those chapters in the appropriate List Of Capthers property of a Book object....
1 Attachment(s)
Re: How to fill a List(Of )
Here a sample -it is one of the thousand way you could do it. The sample is a windows form done with VS 2010.
Even if it seems you could be working on WPF, the way to retrieve data from db can be the same.
I chosed the simplest.
Look inside SqlHelper.vb class and follow the comments. You will need to adjust connectionString and either to provide correct queries or to insert correct tables and fields in your db
By the way: you used an Observable class. I did not implement the pattern that it seems to be adequate for those kind of objects. If you want to explore it, have a look here
http://msdn.microsoft.com/en-us/library/dd990377.aspx
Cimpy