简体   繁体   中英

Vb.net Equivalent exception for Vb6 Error code

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM