Results 1 to 3 of 3

Thread: Treeview, Key not Unique [Resolved]

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    32

    Treeview, Key not Unique [Resolved]

    When I add a record to the database I am getting an error message that my key is not unique. It only happens when I add a different classication. I attached the project below as a zip file. I am in the learning phase so my code may be messed up.

    Thanks..
    Attached Files Attached Files
    Last edited by odamsr; Apr 8th, 2004 at 03:16 PM.

  2. #2
    Fanatic Member ahara's Avatar
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    531
    Hi there;

    Checked out your project and found the problem - and I'd like to thank you for making me realize something I never knew about the treeview.....

    1. The problem was you were trying to create an additonal node that had the same key. The keys must be unique. You were passing 'Title', so if you have more than one title that is the same - crasherama!!

    2. Keys must be strings

    3. What I did not know - I initially tried using your ID field (it will always be unique as you are using Autonumber) - but still it crashed (even when trying to use CSTR to convert it to a string)....so I went to MSDN and saw an example that used the id field. In the example, the field was numeric, but concatenated with a string like " id" to make it a true string


    So as you will see from the code, this is what I did, and it now runs. Cheers
    Attached Files Attached Files
    "Knowledge is gained when different people look at the same information in different ways"

    - Louis Pasteur

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2003
    Location
    Georgia
    Posts
    32
    Thanks.

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