> Dear Ken,
>
> Thanks for your feedback and advise. I've another question need your advise. At first i SELECT all the data INTO CURSOR cMrsShare READWRITE and SELECT * FROM wrk_ordr WHERE date = {^1999/01/01} INTO CURSOR cWrkOrdr READWRITE (i need to create a blank READWRITE CURSOR, that's why i select the date on {^1999/01/01} ).
>
> Then i click on THISFORM.Command1 (Update MRS) to update & insert records at m_updmrs.scx and save it on CURSOR cWrkOrdr & cMrsShare. My EndUser need to insert and update a lot of records at the same time. After they finish, i create another FORM to let them POST (Update and Insert all the records) all the records from CURSOR cWrkOrdr to fews database.
>
> My question is :-
> 1. Is it the way to do that?
> 2. If a lot of data inside the CURSOR cWrkOrdr, take time to update & insert records. Is there anyway to change any method to doing this? Maybe need to change all the structure?
>
> I'll resolve my previous problem by using SET MULTILOCK ON & CURSORSETPROP("Buffering", 5).
>
> Thanks.
>
> Regards,
>
> Stewart Chew
It sounds as if you want to create a "data input batch." If this is the case, then you probably want to use a local table stored in a c:\Documents and Settings\UserName\Application Data\MyApp folder. This way, your user can enter part of a batch, exit the app, and then come back and finish it later. Using a cursor, created from a SELECT ... WHERE .f. INTO CURSOR ... when the user exits the app, your cursor (and any data entry work) is destroyed if it is not saved to a table.
If your updates take a long time to do, it is typically because your UPDATE and INSERT commands are not optimized. Take a look at your UPDATE and INSERT commands, especially the WHERE clause and make sure that you have an index on every field that you see in your WHERE clause.
You ask, "Is it the way to do that?" Most VFP developers will tell you that "if you haven't found three ways to do anything in VFP you haven't tried." There are always other ways to do things :) Is this the "best" way to do it? Again, if you ask three VFP developers "what is the best way to ..." you are likely going to get four answers. Good design always follows the function. Do you need to be able to "save a data input batch" and then go back in to complete it later? It may be that when you look at the requirements more closely, you will find that what you really want is to restrict the user to one open item (work order/Invoice/what ever) at a time.
Ken
You shall know the truth - and the truth shall set you free. (John 8:33)