CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 Database errors

Print topic Send  topic

Author Message
Grzegorz
Posted: 04/24/2003, 9:01 AM

Hi!
This question was asked some time ago but it was not answered...
How to catch errors/exceptions raised by database and add info to error block?
For example there is a constraint in the database (FK) and deleteting record raises exception. I'd like to add info "Can't delete master when detail exists" or something like that to error block, instead of database (PostgreSQL) error page.
How to do it?

Regards,
Grzegorz
hamilton
Posted: 04/25/2003, 7:36 AM

There's an example in the CCS 2.0 documentation

located under: Examples and Techniques|Working With Databases|Execute Custom SQL

Note there are a couple more examples, besides this that demonstrate the use of the database errors collection.

Function Tasks_DataSource_AfterExecuteUpdate()
Dim SQL
Dim Connection
Dim ErrorMessage

SQL = "INSERT INTO report (report_task_id,report_creator) "&_
"VALUES ("& CCToSQL(CCGetFromGet("task_id",0),ccsInteger) &","& CCToSQL(CCGetUserID(),ccsInteger) &")"

Set Connection = New clsDBConnection1
Connection.Open
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0

End Function

Hope this helps.

   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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