Hi to all at Code Project this is my first post!
My query is probably very simple to all you experienced vb developers out there but I am from a Excel VBA developer background and trying to learn to develop using Winforms, Visual Studio 2012 and SQL Server in a very short time frame and am looking for any advice / pointers on how to achieve this avoiding any known pitfalls along the way.
The Project
I have been asked to create a hierarchical Treeview from a SQL table with the ability to drag and drop nodes and to also have the underlying data in the SQL table modifed as per the nodes dragged and dropped.
The dataset is one SQL table. (>30000 records) The main relevant fields are 'TagNo' which is a unique record ID field, and 'ParentTag' which hold the parent 'TagNo' (if any) for the record. There are roughly 5600 unique ParentTags (i.e. Parent level nodes)
I have been tasked to achieve this using the 'closure table' method (or Ancestor Tables method as I've seen it referred to) as my boss likes this method of implementation.
Steps Taken so Far
1: Created a new Winforms application containing a SQL dataset (one table showing all equipment to be displayed in treeview), a form to display the treeview and a treeview control on this form.
2: I have read up on: drag and drop methods, how to build a treeview from SQL dataset, setting context menus etc. but have had difficulty tracking down any examples where the changes are also written back to the dataset.
What I would like to know / find
1: Is the Closure Table method suitable for this task? If so, a simple method to build a closure table from the SQL table? If not, what method would you recommend instead?
2: Any known examples of writing data changes back to the underlying dataset after drag and drop of nodes (i.e. not just altering how the data is displayed in treeview but updating the SQL data table.)
Any pointers on methods, resources or examples of this would be greatly appreciated as I am a bit overwhelmed by the amount of 'Treeview' examples out there, none of which seem to show how to write the changes back to the underlying SQL dataset?
I presume it's just a matter of running UPDATE queries after the drag and drop event is triggered but would like to see how to do this "properly" and efficiently and would also like to see an exmaple of the closure table method if anyone has implemented this?
Thanks in advance.