Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting a record between two records
Message
From
22/02/2006 13:05:22
 
 
To
22/02/2006 12:48:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01098167
Message ID:
01098194
Views:
19
>Could you elaborate a bit, please?

to insert a record in the physical table's position N
is as to
- define a integer field
- define a index on field TAG host
- set the active order to the "host" index tag

* insert
- set field = field + 1 for all records with field >= N
and set the insert record's field value to N ( this put the key in physical tag's position N)
* with code
TRY
* BEGIN  TRAN or tablebuffer with FLOCK()
 
 SET ORDER host DESCENDING
 REPLACE ALL WHILE field>=N field with field + 1
 INSERT ... FIELD ... VALUES ... N ....
* END TRAN or tableupdate() and unlock
CATCH
* ROLLBACK
FINALLY
 SET ORDER host
ENDTRY
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform