CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Retrieve Database Error code

Print topic Send  topic

Author Message
rado

Posts: 221
Posted: 06/28/2009, 11:32 AM

I have record form which works with table that has relationships with another table. So when I try to insert the record that already exist I got error message:
"Database Error: Duplicate entry '1-108-9' for key 1" which is OK. If record doesn't exist no error message show up. (OK as well).
The same record has in After Insert Event an additional sql query that is updating another table. (it works just fine). However when I get the "Database Error: Duplicate entry '1-108-9' for key 1" error message when I try to insert duplicate record I would like to skip the query written in "After Insert Event ". The way to do that is to somehow get DB error code from "Database Error: Duplicate entry '1-108-9' for key 1" message. I tried "if ($Container->Errors->Count == 0)" but it doesn't work since the error message is passed from DB.

My question is how I can get the database error code after any transaction.( In my case after insert.) so I can check it and make appropriate action (if success do additional query , if not skip additional query)

Thanks,

Rado
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.