none
Getting OleDbException error but Errors.Count = 0 RRS feed

  • Question

  • I'm using Oledb to connect to my DB.  There is a constraint error that is happening but when my catch executes the OleDBException variable says that there is zero rows in the errors object but returns a generic error.  I'm trying to find a way to get a more detailed error.

    Thank You
    Tuesday, February 23, 2010 5:41 PM

Answers

  • Not being familiar with that OLEDB Provider it could also be that it's not returning the exception(s). One way to verify this would be to add a Reference to the COM ADO (Microsoft ActiveX Data Objects 2.8 Library) or the .NET adodb primary interop assembly and generate the exception using the ADODB objects. The ADODB Connection object has an Errors collection you can check for the constraint exception. If it's not present then I would have to say it's an issue with the OLEDB Provider.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, February 23, 2010 11:34 PM

All replies

  • Which OLEDB Provider are you using and what is the constraint?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, February 23, 2010 7:41 PM
  • Paul,
    I'm using SAS/SHARE provider.  It's a table contraint error on a delete.  I'm trying to find a way to get the full error message back.  I thought through the oledb command object that since it is connecting to the provider it would return that providers error messages.

    Thank you for your reply and help

    Tuesday, February 23, 2010 8:35 PM
  • Not being familiar with that OLEDB Provider it could also be that it's not returning the exception(s). One way to verify this would be to add a Reference to the COM ADO (Microsoft ActiveX Data Objects 2.8 Library) or the .NET adodb primary interop assembly and generate the exception using the ADODB objects. The ADODB Connection object has an Errors collection you can check for the constraint exception. If it's not present then I would have to say it's an issue with the OLEDB Provider.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, February 23, 2010 11:34 PM