Help with Terminology Please
Hello,
I have been given a task to do and I am struggling to understand fully and was wondering if any of you could hlep explain it to me please ?
I need to bind data from an access database to a datagridview. (the DB simply holds a list of product with their stock code, desription etc)
I need to bind this datagridview to a products collection without using a dataset to bind to the datagridview.
I really don't understand this fully. Can anyone explain what it means
Thanks.
Re: Help with Terminology Please
Use a DataTable maybe? :)
On the other hand, you could always ask the person that gave you the specs to clarify what he/she means.
Re: Help with Terminology Please
Thanks Stanav - I would ask for clarification but it's for a test so I can't really.
I'm happy to do the work I simply want to make sure I fully understand what is meant by "binding a datagridview to a collection without using a dataset"
I have created a products class and created properties for ID, Stock Code and Description.
If I wasn't linking to an Access DB I could create a new collection, and populate the collection on the form load event manually e.g. :
Code:
Dim m_Products As Collection
m_Products = New Collection
m_Products .Add(New Products ("1", "0001", "Bicycle"))
m_Products .Add(New Products ("2", "0002", "Car"))
m_Products .Add(New Products ("3", "0003", "Bus"))
DataGridView1.DataSource = m_Products
However, I'm not sure where the connection to Access fits in.
Also, I'm not sure if the above is even right.
Re: Help with Terminology Please
that is not a well phrased question, strictly a dataset is a method of storing data therefore a datatable, datareader or a datasource are forms of dataset, also it is not clear what kind of binding is expected(early or late) i really would ask for clarification or you could be completely wrong with the test
Re: Help with Terminology Please
I think what that person means is to create your own class to represent a product. You then create a collection of this class (such as a List(Of Product) for example. Using a datareader, you connect to your DB to read the product table and populate your collection. Once done, you bind that collection to the DGV.
Re: Help with Terminology Please
oh i see, read the data put it in a list and then bind to the list to populate the dgv. for sure i'd use datasource to display the results and it looks like jonny1409 is kinda going down the right road but needs to put them adds in a class that parses the data