CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2005
    Posts
    76

    treeview prob urgent, sorry

    I have this 2 Fields in access table.

    Master_agengy
    Sub_agengy
    Dates_operation

    How to fill a treeview named My_Tree


    Master_agengy is the big root

    Sub_agengy is a sub root

    Dates_operation is the last element refered Sub_agency

    (I use ado jet and access database connection just opened is CONN and Recordset is RS)

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: treeview prob urgent, sorry

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: treeview prob urgent, sorry

    Your two fields seem to be three fields???
    If you could make the structure of your data more clear, we could give more detailed instructions of how to fill your treeview.

  4. #4
    Join Date
    Jan 2005
    Posts
    76

    Re: treeview prob urgent, sorry

    Quote Originally Posted by WoF View Post
    Your two fields seem to be three fields???
    If you could make the structure of your data more clear, we could give more detailed instructions of how to fill your treeview.
    see the attached txt file
    Attached Files Attached Files

  5. #5
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: treeview prob urgent, sorry

    Well, yes. This shows how you expect the data to be structured in the tree.
    It does not, however, explain how you have the data presently in the access table.

  6. #6
    Join Date
    Jan 2005
    Posts
    76

    Re: treeview prob urgent, sorry

    Quote Originally Posted by WoF View Post
    Well, yes. This shows how you expect the data to be structured in the tree.
    It does not, however, explain how you have the data presently in the access table.
    Sorry but my data contain a reserved data, can i post in private?

  7. #7
    Join Date
    Jan 2005
    Posts
    76

    Re: treeview prob urgent, sorry

    Quote Originally Posted by WoF View Post
    Well, yes. This shows how you expect the data to be structured in the tree.
    It does not, however, explain how you have the data presently in the access table.
    Attached a little database
    Last edited by sal21; September 17th, 2022 at 09:59 AM.

  8. #8
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: treeview prob urgent, sorry

    Ok, understood. I have my code collection at home. I shall compile you a small sample which does what you want. Going home now. Coming up tonight.

  9. #9
    Join Date
    Jan 2005
    Posts
    76

    Talking Re: treeview prob urgent, sorry

    Quote Originally Posted by WoF View Post
    Ok, understood. I have my code collection at home. I shall compile you a small sample which does what you want. Going home now. Coming up tonight.
    Tks for patience. Pizza for you!

  10. #10
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: treeview prob urgent, sorry

    As promised, here is a small example which loads your sample db1 into a treeview.
    I supposed you wanted one entry for each operation date. If that's wrong, the sample can easily be modified if you understood the principle.

    OpenDB() opens the database

    FillTreeVromDB() walks through the records and plants one branch for each record.

    PlantTreeBranch() is recursive and will plant a new branch into the tree or return a node if that branch already exists. It makes use of the routine

    FindOrMakeNode() which will return a reference to the designated node. If that node does not yet exist it creates it.

    I hope that demonstrates the way of filling a tree from a database.
    If you have more specific requirements, feel free to ask for help with modifications.
    Attached Files Attached Files

  11. #11
    Join Date
    Jan 2005
    Posts
    76

    Talking Re: treeview prob urgent, sorry

    Quote Originally Posted by WoF View Post
    As promised, here is a small example which loads your sample db1 into a treeview.
    I supposed you wanted one entry for each operation date. If that's wrong, the sample can easily be modified if you understood the principle.

    OpenDB() opens the database

    FillTreeVromDB() walks through the records and plants one branch for each record.

    PlantTreeBranch() is recursive and will plant a new branch into the tree or return a node if that branch already exists. It makes use of the routine

    FindOrMakeNode() which will return a reference to the designated node. If that node does not yet exist it creates it.

    I hope that demonstrates the way of filling a tree from a database.
    If you have more specific requirements, feel free to ask for help with modifications.

    IS EXACTLLY WATH I NEED!!!
    i LO... YOU!
    tKS!

    But...
    In original project i have export my access mdb on a SqlServer 2005.
    Not experience... an Sql Server.

    1) i need a good connection string to coonect on SqlServer (and check a a good timeout)
    2) wath is the relevant field to indexed
    3) how to open a at table on SqlServer to write new data
    4) Tath is all
    5) sorry for my bad english but i have understand you understand me on fly!.( i'm Napolitan people.... i know well, sure only a spaghetti and pizza, not english:-))

    Note:
    If you want to change a litle word tell me if have an account on msger, skipe or fb... send me in private, naturally if you want:-)
    Last edited by sal21; April 5th, 2011 at 01:47 PM.

  12. #12
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: treeview prob urgent, sorry

    I'm not familiar to SQLServer 2005. But the princple should be the same.
    For the proper connection string you will surely find it here: http://www.connectionstrings.com/
    Data handling should be identical to ADO as before, so writing new records should work as before.
    If you prefer SQL, however, you'd need an Insert statement, but don't ask me, I'm not the SQL crack here.

  13. #13
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: treeview prob urgent, sorry

    Sorry for this second nonsense post, but the forum did a double post and I simply emptied it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured