VB6 Error While compile

2019-08-15 18:30发布

问题:

I am trying to update a legacy application which has the IP hardcoded into the DB connect string, It errors with "Method "~" of object "~" failed" We are not sure why we are getting this error, can we get VB6 to give us more detail or can we change the IP of a DB connect in an compiled EXE.

回答1:

Another check you might want to give a go is setting Option Explicit on for the entire project. This will show you the variables that have not been explicitly declared.

Also you might want to investigate all variables of type Object: Late Binding can be an unintended pain and I suggest to have as little Late Binding as possible.

Then there is COM. If the application has been compiled and tested against a different version of a COM component such as the OLEDB/ADO MDAC components and now is running against new versions, methods might have been removed or renamed.

Finally, try to add more/better error handling so you know exactly what line of code generates the error.

EDIT If you do not have the source code, the only option left is to findout against what versions of MDAC/Database components the application has been tested.



回答2:

Look in the projects "References" are any missing?

It's been awhile but I'd check for missing references before anything else.

Update

That's a good question. Vb6 references show the used references first, then all the ones that are available. The available items aren't checked and are shown in alphabetical order. If you have a missing reference, it will be grouped at the top of the list with the selected items, but won't be checked. i.e. Any unchecked references that come immediately after the selected references, and that aren't in order are the "missing" references.



回答3:

it can concern MDAC DLL , you can found here a detailled answer for this kind of problem.