Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. CreateChildView vs GetChildRows

CreateChildView vs GetChildRows

Scheduled Pinned Locked Moved C#
visual-studiodata-structureshelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KeesVer
    wrote on last edited by
    #1

    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

    L L 2 Replies Last reply
    0
    • K KeesVer

      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

      L Offline
      L Offline
      lost in transition
      wrote on last edited by
      #2

      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!!!

      K 1 Reply Last reply
      0
      • K KeesVer

        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

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        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!

        **

        K 1 Reply Last reply
        0
        • L lost in transition

          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!!!

          K Offline
          K Offline
          KeesVer
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • L leppie

            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!

            **

            K Offline
            K Offline
            KeesVer
            wrote on last edited by
            #5

            Reflector? I never used it, where can I find this tool? Kees

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups