Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code only runs correctly in debug mode
Message
 
To
01/08/1998 14:40:55
John Thomason
King Richard Veterinary Centre
Leicester, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00123317
Message ID:
00123328
Views:
19
>Can anyone tell me why code sometimes only runs correctly when in debug mode. In this particular instance I am using a method to scan through a table and add new records on the basis of certain criteria in the existing records. The primary key field is set to be automatically generated by newid(). If I run the code in debug the field is generated successfully, if I run the application normally I get the error "Uniqueness of index is violated" because the primary key is not being generated.
>
>Any help would be greatly appreciated.
>
>J.Thomason

John,

Are you using SYS(3) or SYS(2015) for the unique ID? If you are you have a time dependent problem. SYS(3) and SYS(2015) can both return same values on very fast computers. The reason it works with debug on is that debug slows the code down. Both sys(3) and sys(2015) base their values on the system clock and the clock only ticks every 1/18th of a second. So if you hit your NewId function within 1/18th of a secodn from the last hit, you will get the same ID.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform