How to replace SQL Errors with custom Error messages

How to replace SQL Errors with custom Error messages

Post by Yvel Girodie » Wed, 14 Jun 2000 04:00:00



Hi,

I am trying to trap SQL Errors and replace them with custom error messages
from MS Access 97. Example: if a user tries to update or delete a records
where their have Select access only, he/she will my custom error message,
then "ODBC Call failed", follow by an Update Permission Denied on the table.
It is not nice at all.

Please help!

Thank you!

Yvel

 
 
 

1. Custom Task Error Handling - Displaying Custom Error Message

Hi,

I'm currently working on creating a custom task in VB6.
When it comes to error handling, the recommended error
handling procedure in MSDN is to bubble up the error to
the package event sink using oPackageEvent.onError().
Hence:

--- Sample Code Starts ---

Private Sub CustomTask_Execute(ByVal pPackage As Object,
ByVal pPackageEvents As Object, ByVal pPackageLog As
Object, pTaskResult As DTS.DTSTaskExecResult)
   On Error GoTo errHandler

   ' Business logic
   openConnection(param, param)

   pTaskResult = DTSTaskExecResult_Success
   Exit Sub

errHandler:

   pTaskResult = DTSTaskExecResult_Failure
   if Err.Number=xxxx Then closeConnection

   ' Bubble errors to the package eventsink
   If Not pPackageEvents Is Nothing Then
      pPackageEvents.OnError "CustomTask_Execute method
failed", Err.Number, Err.Source, Err.Description, "",
0, "", True
   End If

   Exit Sub
End Sub

--- Sample Code Ends ---

However, I notice that when error is raised, the specific
error message (Err.Description) will not be displayed on
the DTS Designer execution status dialog box. The only
message I'll get would be "The task reported failure on
execution".

I'm not sure if I have done it correctly. Anyone knows how
to get the custom error messages displayed?

Thanks!

Philip Tan

2. SQL2000 Personal Edition

3. Custom error message in custom Web publishing

4. Upgrading from v3.0 desktop to server edition

5. Error handling and custom error messages

6. Retrieving Schemas form SQLServer

7. How can i replace error message (T-SQL)?

8. set user

9. Raising/returning custom error message to SQL Agent from job-executed DTS pkg

10. Ambiguous replace error message

11. How to add custom DTS error messages?

12. Adding more robust error messages to a custom task

13. Custom Error Message Problems