Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert overwrites existing record
Message
De
28/04/2003 16:03:35
 
 
À
28/04/2003 15:55:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00782413
Message ID:
00782445
Vues:
9
Does it happen regularly at a certain point in the month -- like month end?

AV profile should exclude DBF, CDX files, etc.

Programs that do defragging and other disk manipulation on open files are designed to handle files like Word documents, not database table files. Those can mess up indexes.

Jay



>It is a network drive. The hardware team at the company runs disk checkers on a regular basis. They are also running an Antivirus.
>
>My code gets the next key by using a next key table, and the following code:
>
>LOCAL lnOldSele,lnRetVal, lnReprocess
>lnReprocess = set("reprocess")
>set reprocess to automatic
>
>lnRetVal=-1
>lnOldSele=SELECT()
>IF !USED(THIS.rcSystemAlias)
> USE (THIS.rcSystemAlias) IN 0 SHARE AGAIN
>ENDIF
>SELECT (THIS.rcSystemAlias)
>IF UPPER(ORDER())<>UPPER(THIS.rcSystemOrder)
> SET ORDER TO (THIS.rcSystemOrder)
>ENDIF
>IF NOT SEEK(UPPER(THIS.rxId))
> lnRetVal=-1
>ELSE && found what they were looking for
> IF ! RLOCK()
> ** couldn't lock the system record
> lnRetVal=-2
> ELSE && able to lock the system record
> lnRetVal=EVAL(THIS.rcNumberField)
> REPLACE (THIS.rcNumberField) WITH lnRetVal+1
> UNLOCK
> ENDIF && able to lock the system record
>ENDIF && not able to find the ID they passed
>SELECT (lnOldSele)
>set reprocess to lnReprocess
>RETURN lnRetVal
>
>
>I have been using this method for years without a problem. As a matter of fact, I have been using the same framework for years without a problem (it is homegrown). Could this be a network problem?
>
>
>
>>Have you run SCANDISK or CHKDSK as applicable on the disk in question? Is there any antivirus software in operation?
>>
>>How does your code "find the next available key"?
>>
>>>Forgot to mention that part. I have rebuilt the indexes. Still same thing. This bug only happens about once a month.
>>>
>>>>>Ok, this is a weird one. I have an order entry system that has a Order Header Table and a Line Items Table. The user can start an order and then add multiple line items. This part works fine. Occasionally, however, adding a new line overwrites an existing line (always from a different order). When the user clicks the "New Line" button, the code finds the next available key and then performs a SQL Insert command to insert the new line. But, when this bugs crops up, even the Primary Key is changed to a new key. Nowhere in the system do I have a replace that replaces the primary key.
>>>>>
>>>>>I know that an old record is getting overwritten because I am using TakeNote's FoxAudit, and it shows when it happened and who did it, the value it was before and the value it changed to.
>>>>>
>>>>>By all reasoning, this can't be happening, but it is. An insert command is overwriting an existing record. Does anyone have any suggestions on this???
>>>>
>>>>Might be a corrupted index. Rebuild if possible (i.e. DELETE TAG ALL, etc.) (may not be easy if you have RI set up to use indices) rather than REINDEX.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform