Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TABLEUPDATE(2,.T.) leaves records that are not updated
Message
De
07/05/2001 08:18:01
 
 
À
27/04/2001 14:16:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00500580
Message ID:
00504129
Vues:
23
>>I'm updating a view (buffering=5), even go top, the TABLEUPDATE(2,.T.) returns .t., but trying to change buffering results in an error.
>>
>>What am I doing wrong, or how do I get it right?
>
>Check the return value of TABLEUPDATE, if it returns .F., use AERROR to see why.
>
>If it returns true, but it appears that some records were not updated, I would guess you have a problem with primary keys?

Right you are, it's the PK.
Now the question remains, what's the fastest way to find the offending record(s)?

I have tried this, it works, but it's so sloooow...
	llResult=TABLEUPDATE(2,.T.,"DetailView",Errors)   && Try to update the lot
	lnRecNo = GETNEXTMODIFIED(0,"DetailView")
	DO WHILE lnRecNo <> 0
		llRetVal=TABLEUPDATE(1,.T.,"DetailView",Errors)  && This is supposed to get me to the next modfied record, right?
			IF NOT llRetval AND NOT TABLEUPDATE(0,.T.,"DetailView",Errors)  && Try and update this one
				=AERROR(Errors)
				lcError=""
				FOR N = 1 TO ALEN(Errors)
					lcNextError=Errors(N)
					lcNextError=IIF(TYPE("LCNEXTERROR")="N" OR TYPE("LCNEXTERROR")="I",ALLTRIM(STR(lcNextError)),lcNextError)
					lcError=lcError+lcNextError+" "
				ENDFOR
				ldDate=DATETIME()
				lnResult=SQLEXEC(lnHandle,[INSERT INTO ERRORLOG (Date,Event) VALUES (?ldDate,?lcError)])
				TABLEREVERT(.F.,"DetailView")
			ENDIF
		lnRecNo = GETNEXTMODIFIED(lnRecNo, "DetailView")
	ENDDO
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform