Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Primary key problem
Message
From
26/10/2001 13:51:03
 
 
To
26/10/2001 11:42:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00573665
Message ID:
00573810
Views:
19
Hi,

Thanks for your reply. I realized the way I am doing this will not work and in the long run give more troubles. Do you know of a good way I could 'relate' the treeview to a table? For example, if I click on a leaf or node how can I determine which record in my table this corresponds to. I was using the node.index before but I don't think this will work.

Thanks,
Chris

>>Hi,
>>
>>I've got a problem with primary keys. They look like "00001", "00002", etc. Anyways I have run into a situation where I have to reuse them. So for example, if the table contains five records, "00001", "00002", "00003", "00004", "00005" and the user deletes "00003" I wind up with "00001", "00002", "00004", "00005". I have to change it to "00001", "00002", "00003" (used to be 00004), "00004 (used to be 00005). I do this with the following code. The order is set to "tid" which is the Primary key.
>>
>>scan rest
>>     replace tid with padl(str(val(tid)-1),5,"0")
>>endscan
>>
>>
>>I get a uniqueness of primary key error. I have set deleted on. If I do a pack it works, but I can't do that when the users are using it. Any ideas on how to solve the problem without making the primary key not primary? I am working with a treeview active x control and I am using this as a way to identify an item. The treeview source is a table. When the user deletes one, it is deleted from the table. Then I clear the treeview and add all the items all over again. Maybe there is a better way of doing this? It seemed like overkill when I did it, but can't think of any other way as I need to have the primary key matching the key for that item created by foxPro when the treeview is created.
>>
>>Thanks!
>>Chris
>
>Chris,
>Primary keys are for you as an idenifier not for the end user, right ? If so you don't need to make them sequential to work with treeview. IMHO leave as is. Treeview doesn't care they're ordered but just be unique.
>Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform