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