Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enhancing Performance
Message
From
21/06/2014 21:39:44
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
20/06/2014 14:41:11
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01602118
Message ID:
01602185
Views:
92
Hey Rich

I goofed. I thought he was using SQL Insert, but that was while I was looking at Fernando's code. You were correct that the OP must avoid INSERT BLANK.

Mike

>>Performance Increased a Lot particularily by Using
>>
>>IF MOD(lnCount, 100) = 0
>>WAIT WINDOW 'Remaining Records...'+ALLTRIM(STR(RECNO())) NOWAIT
>>ENDIF
>>
>>However this line is inserting records at the bottom of file and not below the required record so I have kept my original code there
>>
>>INSERT INTO BillFile (POS) VALUES (cTexttwo)
>>
>>Any suggestion , Please Intimate
>>
>>Harsh
>
>The old INSERT command has been deprecated in VFP (meaning it is still there but it isn't recommended that you use it).
>
>If I remember correctly, that's because it needs to rebuild the file each time you do the insert command. For small files, the processing time is negligible and doesn't have a material impact on performance. But, the bigger the file, the longer each iteration takes and you reach a point where the system slows to a crawl.
>
>I would suggest something like
>SELECT *,000000000.0000 as SortKey FROM billfile INTO CURSOR billfile2 READWRITE
>REPLACE ALL sortkey WITH recno() IN billfile2
>lnInsertnum = 0.0000
>
>** Do your code and when you come to the point where you want to do the insert
>
>
lnInsertnum = lnInsertnum + .0001
>lnSortKey = sortKey + lnInsertNum
>
>INSERT INTO billfile2 VALUES ( < all the insert values >,lnSortKey)
>
>** finish your code.
>
>At the end you can
>
SELECT < all the fields except sortkey > FROM billfile2 ORDER BY sortkey INTO CURSOR billfile READWRITE
>
>and I would expect the records to be in the sequence you want. If the way I've expressed it isn't clear, maybe somebody can explain it better.
>
>........Rich
Previous
Reply
Map
View

Click here to load this message in the networking platform