Unique field bug?

jda jda at his.com
Sat Oct 23 16:21:45 CDT 2004


>On 10/23/04 9:47 PM, "jda" <jda at his.com> wrote:
>
>>  I'm adding records in which there is one unique field, uniqueID. I
>>  trying to trap for exceptions with the following code:
>>
>>       i = myCursor.LongField("uniqueID").value
>>       do
>>         try
>>           cursPosition = myCursor.addRecord
>>           catch vError as VException
>>
>>           if cursPosition = 0 then //and myDatabase.errNumber = 344
>
>Note, 2.0 have different numbers for error codes!!!
>So it is not 344.
>
>>  then duplicate uniqueID --will update when v2 has error constants
>>
>>             i = i + 1
>>             myCursor.LongField("uniqueID").value = i
>>           else
>>             raise vError
>>           end if
>>         end try
>>       loop until cursPosition <> 0
>>
>>  The exceptions are trapped properly, but when it's finished a record
>>  is added for EVERY time cursPosition = myCursor.addRecord was called.
>>
>>  So if the first add -> exception and the second is successful, I end
>>  up with two records (each having the same uniqueID value, BTW!).
>
>I have not understand,
>
>You say that record IS ADDED _and_ exception is throw?
>

Yes, that's what seems to be happening...

Jon


More information about the Valentina-beta mailing list