错误“方法”〜对象“〜”的失败”编译时 [英] Error "Method "~" of object "~" failed" While compiling
问题描述
我正在尝试更新已将IP硬编码到DB连接字符串中的旧版应用程序,它的对象〜的方法〜失败错误。我们不确定为什么会收到此错误,我们可以获取VB6可以为我们提供更多详细信息,或者我们可以在已编译的EXE中更改数据库连接的IP。
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.
推荐答案
另一个检查您可能要放弃的是为整个项目设置 Option Explicit
。这将向您显示尚未显式声明的变量。
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.
此外,您可能希望调查所有 Object $ c $类型的变量。 c>:后期绑定可能是意外的痛苦,我建议尽量减少后期绑定。
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.
然后是COM。如果应用程序已针对其他版本的COM组件(如OLEDB / ADO MDAC组件)进行编译和测试,并且现在针对新版本运行,则方法可能已被删除或重命名。
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.
编辑如果您没有源代码,则剩下的唯一选择就是找出已对应用程序进行了测试的MDAC /数据库组件版本。
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.
这篇关于错误“方法”〜对象“〜”的失败”编译时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!