Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uniqueness of Indexes - how do you handle this?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00376137
Message ID:
00376381
Vues:
40
>It's a great advice. I think, it should work for tables also (I always use table buffered mode). Could you also provide a code example, please?

Here is some (pseudo) code you could use:
DIMENSION laError[1]
llOK = TABLEUPDATE(2,.T.,ALIAS(),laError)
IF llOK								&& TABLEUPDATE was successful
	* Force any relations to be updated.
	GO (RECNO())
ELSE									&& TABLEUPDATE failed
	IF laError[1]<>-1
		FOR EACH dlnRecno in laError
			&& Record dlnRecno couldn't be updated
		ENDFOR
	ELSE
		AERROR(laError)
		DO CASE
		CASE laError[1,1] = 109		&& Record is in use by another user
		CASE laError[1,1] = 1526		&& ODBC error occurred
		CASE laError[1,1] = 1539		&& Trigger failed
			DO CASE
			CASE laError[1,5] = 1	&& Insert trigger failed
			CASE laError[1,5] = 2	&& Update trigger failed
			OTHERWISE					&& Delete trigger failed
			ENDCASE
		CASE laError[1,1] = 1581		&& Field doesn't accept null values
		CASE laError[1,1] = 1582		&& Field rule was violated
		CASE laError[1,1] = 1583		&& Row rule was violated
		CASE laError[1,1] = 1884		&& Uniqueness of an index was violated
		OTHERWISE						&& Unknown error
		ENDCASE
	ENDIF
ENDIF
hth,
Frank Camp
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform