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
Can anyone please help to know the equivalent exception for the above two error codes
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.
User contributions licensed under CC BY-SA 3.0