CreateChildView vs GetChildRows
-
Hello, I want to load an hierarchical view using two tables: Companies and users. There are about 25000 records in both tables. If I use CreateChildView to retrieve the child rows for everycompany record, building the complete tree takes about 3 minutes (!!): foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.CreateChildView("Companies_Users"); } However, when I use GetChildRows the same code only takes 80 ms: foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.Row.GetChildRows("Companies_Users"); } Can anyone explain why there is such a big difference? Thanks for any help you can give me. Regards, Kees Vermeulen
-
Hello, I want to load an hierarchical view using two tables: Companies and users. There are about 25000 records in both tables. If I use CreateChildView to retrieve the child rows for everycompany record, building the complete tree takes about 3 minutes (!!): foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.CreateChildView("Companies_Users"); } However, when I use GetChildRows the same code only takes 80 ms: foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.Row.GetChildRows("Companies_Users"); } Can anyone explain why there is such a big difference? Thanks for any help you can give me. Regards, Kees Vermeulen
Shooting from the hip, I would say step back to your data adpter and fill it will both tables then set the relationship of your data view. (I know you can do this with a datagrid haven't done this with a data view). I just seems you are going the long way about.
Sometimes simply is better than fancy. The developer stated after typing code line 10 billion!!!
-
Hello, I want to load an hierarchical view using two tables: Companies and users. There are about 25000 records in both tables. If I use CreateChildView to retrieve the child rows for everycompany record, building the complete tree takes about 3 minutes (!!): foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.CreateChildView("Companies_Users"); } However, when I use GetChildRows the same code only takes 80 ms: foreach(DataRowView dr in companiesBindingSource) { IList childs = dr.Row.GetChildRows("Companies_Users"); } Can anyone explain why there is such a big difference? Thanks for any help you can give me. Regards, Kees Vermeulen
CreateChildView will create controls too I susoect. Have a look in Reflector what is happening inside those methods.
**
xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!
**
-
Shooting from the hip, I would say step back to your data adpter and fill it will both tables then set the relationship of your data view. (I know you can do this with a datagrid haven't done this with a data view). I just seems you are going the long way about.
Sometimes simply is better than fancy. The developer stated after typing code line 10 billion!!!
I want to display a complete view at once: Company 1 - User 1 - User 2 Company 2 - User 3 - User 4 etc. Therefore I run through all parent records, fetch the children and store them both in a flat list. This is different from having two separate grids, one showing the parent records and one showing the children of the selected parent record. Loading the data into the tables is no problem (calling Fill() only takes about 400 ms). Only building the view takes time when using CreateChildView instead of GetChildRows. Kees
-
CreateChildView will create controls too I susoect. Have a look in Reflector what is happening inside those methods.
**
xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!
**