Crystal Reports仅在其他PC上提示登录

时间:2012-01-10 05:35:28

标签: vb.net ms-access crystal-reports report

我制作了一个包含Crystal Report的小型VB.NET应用程序。在机器上运行Crystal Report我完美运行。当我在笔记本电脑上运行应用程序时,Crystal Report总是会提示我登录,尽管数据库没有设置登录名。我尝试使用代码传递“Admin”和“”,但没有运气。

我正在使用Access数据库,这是我必须加载Crystal Report的代码:

If frmReport Is Nothing OrElse frmReport.IsDisposed Then
  frmReport = New frmReport
End If

frmReport.CrystalReportViewer1.ReportSource = "../../Reports/Klantenbeheer.rpt"

frmReport.MdiParent = Me
frmReport.Show()

我确实看过Prevent login of ODBC Text driver in Crystal Report for Visual Studio 2010,但我不确定它是否适用于我的情况?

我还尝试将rpt的数据源设置为我在应用程序中使用的数据源,然后将其分配给ReportSource,但也没有运气。

有些人找到了从DAO转换到OLEDB的解决方案,但我从一开始就使用OLEDB。

2 个答案:

答案 0 :(得分:0)

也许at the bottom of this thread中的代码可以帮到你?具体做法是:

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
Dim myReport As New ReportDocument()
myReport.Load(Server.MapPath("ReportName")) 'name of your Crystal Report - see note below

Dim myTables As Tables = myReport.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myConnectionInfo.ServerName = <SQL servername>
myConnectionInfo.DatabaseName = "" 'leave database name blank
myConnectionInfo.UserID = 'login name
myConnectionInfo.Password = 'password
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next

CrystalReportViewer1.ReportSource = myReport

它是为ASP.Net制作的,但可能会进行微调?

答案 1 :(得分:0)

嗯,我知道这是一个老问题。但我想我应该添加一个信息,我得到一个链接,经过痛苦的研究,他告诉我们,我们必须复制正确版本的crdb_ado.dll。请在此处阅读:XtremeNetTalk。不幸的是,我还没能在互联网上找到该文件!我希望我能用这个完成这个答案。