Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TableUpdate(), Pls Help
Message
De
18/07/2004 22:37:52
 
 
À
17/07/2004 10:29:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00925076
Message ID:
00925627
Vues:
16
I use this parameter (tableupdate(.t.,.f.,"table")) all the time, never had such problem.

However, I figured out that if I type something in Memo field and than issue TableRevert() it will cause record pointer to change during next TableUpdate().

Now, I am setting focus to some other control before tablerevert(). This seems to have worked.


>If the first parameter for TableUpdate() is .T., this means that changes to all records will be saved. IMO, you can't expect a command that processes multiple records to stay on the current record. For comparison, a REPLACE ALL will move the record pointer to EOF.
>
>You can use TableUpdate() only for the current record, with appropriate parameters.
>
>If you need to TableUpdate() all records, and still stay on the current record, you will have to save recno() to a variable, and go back to it later.
>
>>Yes, I issue TableUpdate for each tables, (.t.,.f.,[tables])
>>
>>It does not return .f. to tableupdate command. However, it still jumps record pointer.
>>
>>I did not noticed this behaviour earlier.
>>
>>Why it is changing record pointer.
>>
>>I was able to reproduce the error;
>>
>>
>>1. Open a Record (open a form) (e.g. recno() = 12)
>>2. mark the record as lock (repl rec_lock with .t.)
>>3. tableupdate(.t.,.f.,"tableA")
>>4. show form
>>5. change text under memo field (Editbox)
>>6. from within editbox, press ESC key
>>7. ESC fires exit without save procedure
>>8. tablerevert(.t.,"tableA")
>>9. unmark record (repl rec_lock with .f.)
>>10. tableupdate(.t.,.f.,"tableA")
>>11. hide form
>>12. move to another record (e.g. recno() = 15)
>>13. Open the record (recno() = 15)
>>14. lock record (repl rec_lock with .t.) (recno() = 15)
>>15. tableupdate(.t.,.f.,"tableA")
>>16. Record pointer changes to recno() = 12
>>
>>
>>I don;t have any clue why this is happening??
>>
>>Regds/Shaishav
>>
>>
>>>>Re: TableUpdate()
>>>>Can you pls explain why it will not save records in TableB, what is the work around?
>>>
>>>Some things to check:
>>>
>>>If you have several tables, you must do TableUpdate() for each table. (I think you did this.)
>>>
>>>See if TableUpdate() returns .T. or .F.; .F. means that it could not save.
>>>
>>>If TableUpdate() returns .F., use aerror() to find out what was the problem.
>>>
>>>
>>>if not TableUpdate(...)
>>>  aerror(MyErrorArray)
>>>  MessageBox("Error #: " + trans(MyErrorArray(1) + " message: ";
>>>    + MyErrorArray(2))
>>>endif
>>>
>>>
>>>>
>>>>Re: CHange of record pointer
>>>>For I am only updating one record in TableA, in fact the problem comes when I do the following
>>>>
>>>>
** I am on record 10
>>>>TableRevert(.t.,"TableA")
>>>>** still on record 10
>>>>do something
>>>>TableUpdate(1,.f.,"TableA")
>>>>** still on record 10
>>>>** move to record 15
>>>>do something
>>>>TableUpdate(1,.f.,"TableA")
>>>>** record pointer moves back to 10
>>>>
>>>>
>>>>Why?? Any Answer???
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>>>
>>>>>I have a form with two tables, both are using "5-Optimistic Table Buffering".
>>>>>
>>>>>TableA has one-to-many relationship with TableB. When a record is changed in TableA, there are more than one Records affected in TableB.
>>>>>
>>>>>When I want to issue Table Update, what should I do?
>>>>>
>>>>>Currently I am using
>>>>>TableUpdate(1,.f.,"tableA") and
>>>>>TableUpdate(1,.f.,"tableB")
>>>>>
>>>>>Is it correct?
>>>>>>>
>>>>>
>>>>>There is a danger that the update to tableA will succeed but the update to tableB will fail. Use a transaction to wrap the two updates:
>>>>>
>>>>>BEGIN TRANSACTION
>>>>>IF TABLEUPDATE(1,.f.,"tableA") .AND. TABLEUPDATE(1,.f.,"tableB")
>>>>>  END TRANSACTION
>>>>>ELSE
>>>>>  ROLLBACK
>>>>>  * Handle the failure
>>>>>ENDIF
>>>>>
>>>>>
>>>>>>>
>>>>>I have another problem where when after I issue TableRevert(.t.,"TableA") while on record number X, if I go to Record number Y and issue TableUpdate(1,.f.,"TableA"), the record number changes to X automatically.
>>>>>>>
>>>>>
>>>>>From TableUpdate Help:
>>>>>If table buffering is used and multiple records are updated, TABLEUPDATE( ) moves the record pointer to the last record updated.
>>>>>
>>>>>HTH,
>>>>>Viv
Regards
Shaishav
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform