Unique field bug?

jda jda at his.com
Sat Oct 23 14:47:07 CDT 2004


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 
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!).

Jon


More information about the Valentina-beta mailing list