登录失败、水晶报表 9、VB6、sql server、sqlncli

发布于 2024-08-03 23:29:36 字数 889 浏览 2 评论 0原文

我正在尝试为旧版 vb6 软件构建安装包。该软件本身通过 sqlncli(本机客户端)连接到 sql 服务器。我已经将所有依赖项打包并部署到运行winxp和office2003的新机器上。

现在,我可以从目标机器连接到使用 tcp/ip 在其他地方运行的数据库 (ms sqlserver 2005)。遗留软件可以很好地连接到数据库,我可以操作数据。但是当我尝试打开水晶报告时,事情变得混乱:

我收到一条错误消息“运行时错误'-2147189176(80047e48):登录失败。 详细信息:01000:[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect())"

因为报告是在不同的系统、不同的数据库以及其他什么上设计的......在调用报告之前有一个循环重置每个表的数据库信息:

  For i= 1 To numTables
    Set crTable = crTables.Item(i)
    crTable.SetLogOnInfo dbServer, dbName, dbLogin, dbPasswd
  Next

ConnectBufferString 读取“Connection String=DRIVER=SQL Server;;User ID=user;;Password=;;Database=MY_DB;;Server=192.168.1.3\SQLEXPRESS;;UseDSNProperties=-1 “

似乎没有办法将提供程序显式设置为 SQLNCLI,至少我没有看到任何方法。

在我的开发系统上运行该软件时,一切都按预期工作。

我希望你们能帮助我出了这个。 只是这样我们就不必争论这一点:我也认为这两种技术(vb6 和 cr9)都已经过时了,但在这里切换不是一个选择。

i'm trying to build a setup package for a legacy vb6 software. the software itself connects to a sql server via sqlncli (native client). i've packaged all the dependencies and deploy them to a new machine running winxp and office2003.

now, from the target machine i can connect to the database (ms sqlserver 2005) that is running somewhere else using tcp/ip. the legacy software connects to the db just fine and i can manipulate data. but when i try to open a crystal report, things get messy:

i get an error saying "Run-time error '-2147189176(80047e48): Logon failed.
Details: 01000:[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect())"

since the reports where designed on a different system, different db and what not ... there is a loop before calling the report that resets the db-information for every table :

  For i= 1 To numTables
    Set crTable = crTables.Item(i)
    crTable.SetLogOnInfo dbServer, dbName, dbLogin, dbPasswd
  Next

the ConnectBufferString reads "Connection String=DRIVER=SQL Server;;User ID=user;;Password=;;Database=MY_DB;;Server=192.168.1.3\SQLEXPRESS;;UseDSNProperties=-1"

there doesn't seem to be a way to explicitly set the provider to SQLNCLI, at least i don't see any.

when running the software on my dev-system everything works like it's supposed to.

i hope you guys can help me out with this.
just so we don't have to argue about this : i also think both these technologies (vb6 and cr9) are outdated, but switching is not an option here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

假扮的天使 2024-08-10 23:29:36

您需要擦除表并更改数据库访问配置,请参见下面的示例。
在第一行代码中,如果需要更改连接驱动程序,我举了一个示例,在我的例子中,报告指向 PostgreSQL 数据库,并且需要更改程序才能连接到 SQL SERVER。

myReportObject.Database.Tables(1).DllName = "crdb_ado.dll"       'Connect to SQL with OLEDB
For Index = 1 To myReportObject.Database.Tables.Count
    With myReportObject.Database.Tables(Index)

        .ConnectionProperties.DeleteAll

         .ConnectionProperties.Add "Provider", "SQLOLEDB"
         .ConnectionProperties.Add "Data Source", mySqlIP
         .ConnectionProperties.Add "Initial Catalog", myDB
         .ConnectionProperties.Add "User ID", usr_id
         .ConnectionProperties.Add "Password", pass
         .ConnectionProperties.Add "Integrated Security", 0

    End With
Next

You need to wipe the tables and change the configuration of access to the database, see the example below.
In the first line of code I put an example if necessary to change the connection driver, in my case the report was pointing to a PostgreSQL database and programativamente needed change to connect to a SQL SERVER.

myReportObject.Database.Tables(1).DllName = "crdb_ado.dll"       'Connect to SQL with OLEDB
For Index = 1 To myReportObject.Database.Tables.Count
    With myReportObject.Database.Tables(Index)

        .ConnectionProperties.DeleteAll

         .ConnectionProperties.Add "Provider", "SQLOLEDB"
         .ConnectionProperties.Add "Data Source", mySqlIP
         .ConnectionProperties.Add "Initial Catalog", myDB
         .ConnectionProperties.Add "User ID", usr_id
         .ConnectionProperties.Add "Password", pass
         .ConnectionProperties.Add "Integrated Security", 0

    End With
Next
⊕婉儿 2024-08-10 23:29:36

我知道你在评论中说过你已经解决了这个问题,但我想我会把它扔在那里。 :)

您可以尝试使用

Provider = SQLNCLI

代替,

DRIVER = SQL Server

看看是否有区别。

看看下面的链接。向下滚动页面,直到看到“SQL Native Client 9.0 OLE DB 提供程序”部分。它们显示了使用 SQL Server Native Client 的连接字符串示例。

http://www.connectionstrings.com/sql-server-2005

希望这有帮助。

I know you said in your comment that you've got around this already, but I figured I'd throw this out there. :)

You may try using

Provider = SQLNCLI

instead of,

DRIVER = SQL Server

to see if that makes a difference.

Take a look at the following link. Scroll down on the page until you see the "SQL Native Client 9.0 OLE DB provider" section. They show examples of connections strings using the SQL Server Native Client.

http://www.connectionstrings.com/sql-server-2005

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文