Board index » delphi » Problem with database constraints
Daniel Alvarez
![]() Delphi Developer |
Tue, 18 May 2004 03:57:33 GMT
Problem with database constraints
Hello: I'm working with an Interbase database server 6.0, and Delphi 5.0
enterprise, and I manage database operations using cached updates. The problem is the next: I have defined in a table a constraint like this: Check(Field1 <= Field2) I start a transaction and Post a record in the table with Field1 = -40 and Field2 = -40. After that I apply and commit the updates from the cache (without closing the transaction). The next step is finding the record I previosly appended, and making Field1 and Field2 values = 0. When I try to apply updates of the table, the constraint indicates me that there is an error, but the fields match the condition: Field1=0, Field2=0, so Field1 <= Field2 is true. When I drop the constrant from the database, the operation finalizes OK and the final result is getting Field1 and Field2 = 0 in database. I don't have to say that I commit the transaction when the changes are done. The constraint doesn't happen if I insert the record from SQL Explorer or another interbase administrator. What's happening here? Am I wrong in some way? Am I doing the right operations? Please help me. Thank you very much. Daniel Alvarez |