Exceptions and old error handling

Olivier vidal_olivier at yahoo.fr
Fri Jan 7 14:11:31 CST 2005


perfect, thank you very much Jon !

olivier

Le 7 janv. 05, à 13:42, jda a écrit :

> If you are using RB, use a try/catch block. Here's is some pseudocode 
> for adding a record with a unique integer field:
>
>   x = generateAUniqueID
>   do
>     try
>       myCursor.LongField("uniqueID").SetString(str(x))
>       cursPosition = myCursor.addRecord
>       success = true //this only occurs if the addRecord was successful
>     catch theError as VException
>       if theError.ErrorNumber <> EVError.ConstraintUniqueViolation 
> then //not a duplicate uniqueID
>         raise theError
>       end if
>      x = generateAUniqueID
>     end try
>   loop until success


More information about the Valentina-beta mailing list