How to use the treeview which get its data from MS Access to form the tree.
Thanks.
Think there a few ways to go about doing it, but I do not have the luxury of time to provide the actual coding. Nevertheless, here is what you can do.
Databinding MethodUsing OleDB, create a dataset from the Access mdb file via the use of a OleDbDataAdapter. Next is to add a DataRelation to the DataSet to create a hierarchy, and set Nested to True.Next step is to create a XmlDatasource (since TreeView only accepts SiteMap and XmlDataSource) and set Data to the DataSet.GetXml. Optional is to add a Xml StyleSheet via TransformFile.Finally is to set XmlDataSource as the DataSource of TreeView.Note: I was not able to really get this to work (display) the way I wanted, even after using the Xml StyleSheet, for I am still not really familiar with the TreeView control and the Xml StyleSheet.
Nodes AddingThe best bet is to use the created DataSet and using For.. Next loop to add the TreeNodes to the TreeView yourself.
While you can also use the new AccessDataSource data control to create the DataSet, you would need a DataView (or DataReader) to act as the middle-man. The reason being AccessDataSource.Select(DataSourceSelectArguments) returns a DataView (or DataReader, depending on the DataSourceMode you set).