Vb.net Equivalent exception for Vb6 Error code

0

Hi i am using the vb6 code Logic in my application where i need to manage the error handling. In vb6 ADODB.Errors are used for capturing the exception.

I want to know the exception equivalent in vb.net for the Vb6 ADODB.Error codes

  1. 2147217885 (0x80040e23) A given HROW referred to a hard- or soft-deleted row.
  2. 2147217887 0x80040e21 Errors occurred

Can anyone please help to know the equivalent exception for the above two error codes

c#
vb.net
vb6
vb6-migration
asked on Stack Overflow Jul 27, 2015 by Ramselvaraj • edited Jul 27, 2015 by Ramselvaraj

1 Answer

1

Have a look at This, in particular the section on "Unhandled Errors in Event Handlers". It explains how to use the ADODB Errors collection in a try/catch block.

I don't think you're going to find a way to trap ADODB errors by using equivalent errors thrown in the .Net environment. There aren't one-to-one equivalencies between COM errors and .Net exceptions in general. What happens in this case with ADODB Error objects is that .Net uses interop marshaling to throw the error object into the catch block, wrapping it with the Exception object. You can evaluate the error there. However, the doc doesn't explain how you can iterate the Errors collection to see both of your errors. Perhaps you can post how that's done here once you've figured it out.

answered on Stack Overflow Jul 30, 2015 by BobRodes

User contributions licensed under CC BY-SA 3.0