1

我正在尝试从 VB 6.0 应用程序(连接到 SQL 2000)执行数据库操作。该应用程序在我的本地和测试机器上运行良好,但在 UAT 环境中出现以下错误。

dbConn - Nothing
lErrorNum = -2147024770
sErrorDesc = Method '~' of object '~' failed

我的源代码是:

Dim connectionString As String
connectionString = "DSN = {My DSN Name}"
Private dbConn As ADODB.Connection
Set dbConn = New ADODB.Connection
With dbConn
    .ConnectionString = sConn
    .ConnectionTimeout = 10             
    .CursorLocation = adUseClient       
    .CommandTimeout = 60
    .Open
End With

MDAC 版本是 WINDOWS SERVER 2003 SP1 上的 MDAC 2.8 SP2。(使用 CompChecker 检查)

我已将源代码复制到 UAT 环境并尝试从 IDE 运行它,但仍然出现相同的错误。

4

2 回答 2

0

错误代码是 Win32 工具错误,123 ERROR_INVALID_NAME:文件、目录名称或卷标语法不正确。

听起来ADO没有正确安装。

于 2009-10-14T06:50:58.280 回答
0

One possibility is that you need to install the MS SQL Client tools on the UAT server (http://msdn.microsoft.com/en-us/library/aa197918(SQL.80).aspx). Have you checked the DSN itself using the test connection option? You could also try an DSN-less connection string.

于 2009-10-14T06:59:01.057 回答