Visual Basic应用程序中的错误440 [英] Error 440 in Visual Basic Application

查看:191
本文介绍了Visual Basic应用程序中的错误440的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一个客户端上运行着一个旧的VB应用程序。
此代码段引发异常:

There is an old VB application running at one of my clients. An exception is throws in this peice of code:

cn=GetIndexDatabaseConnectionString()
sSql="SELECT * FROM Arh_Naroc WHERE StNarocila = '" & isci & "'"                            
rs=CreateObject("ADODB.Recordset")
Call rs.Open(sSql,cn)

该异常发生在 rs.Open()函数中。 发生了错误号440。

The exception happens in rs.Open() function. "Error number 440 occured."

这是KOFAX引擎的SBL脚本,已经使用了很多年。
整个软件已从旧的XP计算机转移到Windows 7,似乎到处都有问题。

This are SBL scripts for KOFAX engine and it's many years old. The whole SW was transferred from old XP computer to Windows 7 and looks like there are problems everywhere.

有人可以帮我确定这里的问题是什么。至少如果我能在msgbox中获得正确的错误消息将是最有帮助的。

Can some one help me determine what is the problem here. At least if I could get a proper error message back in msgbox would be most helpful.

编辑:
这是连接字符串函数。

This is the connection string function.

Function GetIndexDatabaseConnectionString
 Dim objXmlDocument As Object
 Dim objXmlGlobalSettingsFileParh As Object
 Dim objXmlIndexDatabaseConnectionString As Object
 Dim strGlobalSettingsFilePath As String
 Dim strTemp As String
 Const strSettingsFilePath = "C:\Data\LocalDocsDistibutingSystem\Settings.xml"
 Set objXmlDocument = CreateObject("MSXML2.DOMDocument")
 objXmlDocument.Load strSettingsFilePath
 Set objXmlGlobalSettingsFileParh = objXmlDocument.selectSingleNode("DocsDistributingSystem/GlobalSettingsFilePath")
 strGlobalSettingsFilePath = objXmlGlobalSettingsFileParh.childNodes(0).Text
 Set objXmlGlobalSettingsFileParh = Nothing
 Set objXmlDocument = Nothing
 Set objXmlDocument = CreateObject("MSXML2.DOMDocument")
 objXmlDocument.Load strGlobalSettingsFilePath
 Set objXmlIndexDatabaseConnectionString = objXmlDocument.selectSingleNode("DocsDistibutingSystem/AscentCapture/IndexDatabase/ConnectionString")
 strTemp = objXmlIndexDatabaseConnectionString.childNodes(0).Text
 Set objXmlIndexDatabaseConnectionString = Nothing
 Set objXmlDocument = Nothing
 GetIndexDatabaseConnectionString = strTemp
End Function

来自Settings.xml的相关行:

This is the relevant line from Settings.xml:

<ConnectionString> Provider=OraOLEDB.Oracle;Data Source=LINO2;User Id=****;Password=****;OLEDB.NET=True; </ConnectionString>

实际数据用*屏蔽。与Oracle的连接似乎正常。我创建了ODBC,并使用提供程序和连接数据将服务器链接到sql。有用。为了使ADODB正常工作,计算机上必须缺少某些内容...

The real data is masked with *. The connection to Oracle appears to be ok. I created ODBC and linked server to sql using the provider and connection data. It works. It must be something missing installed on the computer for ADODB to work...

连接似乎正常。初始化时没有错误。
错误发生在调用rs.Open(sSql,cn)中。我所要的只是发生错误时的详细错误消息...
非常感谢。

The connection appears to be working OK. There is no error when its initialized. The error happens in Call rs.Open(sSql, cn). All i want is the detailed error message when the error happens... Many thanks.

推荐答案

在MS知识库上


在执行方法或获取或设置对象变量的
属性时发生错误。该错误由创建对象的
应用程序报告。检查Err
对象的属性,以确定错误的来源和性质。还可以尝试在访问
语句之前立即在错误恢复下一条语句中使用
,然后在访问
语句之后立即检查错误。

An error occurred while executing a method or getting or setting a property of an object variable. The error was reported by the application that created the object. Check the properties of the Err object to determine the source and nature of the error. Also try using the On Error Resume Next statement immediately before the accessing statement, and then check for errors immediately following the accessing statement.

因此,正如他们建议的那样,检查Err对象的方式类似于:

So as they suggest check the Err object, in a similar fashion to:

If Err.Number <> 0 Then
  Msg = "Error: " & Str(Err.Number) & ", generated by " _
      & Err.Source & ControlChars.CrLf & Err.Description
  MsgBox(Msg, MsgBoxStyle.Information, "Error")
End If

因此,这将在MsgBox中带回错误,但是如果您想更轻松地复制&可以使用Response.Write。粘贴等。

So this will bring back the error in a MsgBox, however you can just use Response.Write if you want it easier to copy & paste etc..

这篇关于Visual Basic应用程序中的错误440的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆