Results 1 to 8 of 8

Thread: Treeview Save and Retrieve Data

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    56

    Thumbs up Treeview Save and Retrieve Data

    I need help on saving contents of my Treeview control to MSSQL 2008 Database and also retrieve it back and display on the TreeView.

    I have been searching online since 2 days now and cant really get help on this for VB6.

    Please help.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Treeview Save and Retrieve Data

    What part are you having trouble with? Basically you just read the data from the treeview and write it to the db and do the reverse to load it back to the tree view.

    What OS are you using? MS SQL 2008 is a bit long in the tooth and I am pretty sure it doesn't work under Windows 10.

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    56

    Re: Treeview Save and Retrieve Data

    Quote Originally Posted by DataMiser View Post
    What part are you having trouble with? Basically you just read the data from the treeview and write it to the db and do the reverse to load it back to the tree view.

    What OS are you using? MS SQL 2008 is a bit long in the tooth and I am pretty sure it doesn't work under Windows 10.
    I need the complete code snippet. I have low knowledge about Treeview. I had to use it on a new project and am able to Parse a Json string to my Treeview and it shows up well. Now i want to be able to save in in MSSQL 2008 Database and be able to retrieve it again in the future.

    I am using Windows 7.

    Thanks much.

  4. #4
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,749

    Re: Treeview Save and Retrieve Data

    you can save treeview to json,and:
    Load Json data to Treeview by ScriptControl Activex With vb6-VBForums
    https://www.vbforums.com/showthread....vb6&highlight=
    Name:  JsonToTreeview.jpg
Views: 377
Size:  28.2 KB

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    56

    Re: Treeview Save and Retrieve Data

    Quote Originally Posted by xiaoyao View Post
    you can save treeview to json,and:
    Load Json data to Treeview by ScriptControl Activex With vb6-VBForums
    https://www.vbforums.com/showthread....vb6&highlight=
    Name:  JsonToTreeview.jpg
Views: 377
Size:  28.2 KB
    Thanks. I have been able to do this. I can save my Treeview contents to Json and load from Json too. Done this. What i need is how to save contents of Treeview to MSSQL Database and able to load from the database again at any time. When data is loaded from Json and displayed on Treeview, i want to be able to save that content in the MSSQL database, so the user can always bring out the information from the database anytime, instead of having to call the URL all over again.

  6. #6
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,749

    Re: Treeview Save and Retrieve Data

    that's the second question,not json.

    it's like ,how to save and read field from sql server
    you can use ado or adodc ocx control
    Last edited by xiaoyao; Jul 30th, 2021 at 04:35 AM.

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2018
    Posts
    56

    Re: Treeview Save and Retrieve Data

    Quote Originally Posted by xiaoyao View Post
    that's the second question,not json.

    it's like ,how to save and read field from sql server
    you can use ado or adodc ocx control
    Been reading this and i think i get what you mean. Since i can show my Json on Treeview, i should focus on saving my Json file to the database. Kindly help with code to save a Json file like the one below to the database and also to retrieve it back from database.

    Thanks.

    Code:
    {
        "status": true,
        "detail": "Verification Successful",
        "data": {
            "Number": "000001900019",
            "Batchnumber": "677899 444404",
            "Linked": "9",
            "FullName": "Tuoyo Dante",
            "Gender": "Male",
            "LinkedEmail": null,
            "PerformanceSummary": [
                {
                    "BALANCE": "0",
                    "AMOUNT": "EUR   0",
                    "OVERDUE_AMOUNT": "0"
                },
                {
                    "BALANCE": "0",
                    "AMOUNT": "EUR   2,000",
                    "OVERDUE_AMOUNT": "0"
                },
                {
                    "BALANCE": "8,256",
                    "AMOUNT": "EUR   6,350,020",
                    "OVERDUE_AMOUNT": "0"
                }
            ]
        }
    }

  8. #8
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,749

    Re: Treeview Save and Retrieve Data

    Use built-in functions (SQL Server) to validate, query, and change JSON data
    2020/06/03

    Applies to: Yes SQL Server 2016 (13.x) and later versions

    Validate, Query, and Change JSON Data with Built-in Functions - SQL Server | Microsoft Docs
    https://docs.microsoft.com/en-us/sql...l-server-ver15

    SELECT JSON_VALUE(f.doc, '$.id') AS Name,
    JSON_VALUE(f.doc, '$.address.city') AS City,
    JSON_VALUE(f.doc, '$.address.county') AS County
    FROM Families f
    WHERE JSON_VALUE(f.doc, '$.id') = N'AndersenFamily'
    ORDER BY JSON_VALUE(f.doc, '$.address.city') DESC, JSON_VALUE(f.doc, '$.address.state') ASC

Tags for this Thread

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