问题描述
我正在尝试通过asp.net部署cr xi r2报告。在开发中它工作正常,但是当我部署到服务器时,我得到了奇怪的响应。如果我加载没有数据的水晶报告(只是一个说测试的文本框),它可以正常工作。如果我更改水晶报告以登录到sql server并显示几个字段,则会发生此错误 -
I am trying to deploy an cr xi r2 report via asp.net. In development it works fine, but when I deploy to the server I get that odd response. If I load a crystal report with no data (just a text box that says test) it works fine. If I change the crystal report to log into a sql server and show a few fields it bombs with this error -
无法打开连接。无法打开连接。 C:\docume~1 \ rt-aab~1 \ aspnet \locals~1\temp\crystalreport1 {7aa46f1d-4f25-4d54-b073-a79954f602d7} .rpt
Failed to open the connection. Failed to open the connection. C:\docume~1\rt-aab~1\aspnet\locals~1\temp\crystalreport1 {7aa46f1d-4f25-4d54-b073-a79954f602d7} .rpt
我使用了尽可能多的合并模块:
I used about as many merge modules as I could come up with:
crystalreports11_5_maps.msm
crystalreports11_5_maps.msm
crystalreports11_5_net_2005.msm
crystalreports11_5_net_2005.msm
crystalreports11_5_rdc_designtime.msm
crystalreports11_5_rdc_designtime.msm
crystalreports11_5_rdc_runtime.msm
crystalreports11_5_rdc_runtime.msm
microsoft_vc80_atl_x86.msm
microsoft_vc80_atl_x86.msm
policy_8_0_microsoft_vc80_atl_x86.msm
policy_8_0_microsoft_vc80_atl_x86.msm
我认为我不需要所有这些......我想我只需要crystalreports11_5_net_2005.msm,但我真的不知道。
I don't think I need all of those ... I think I just need the crystalreports11_5_net_2005.msm but I dont really know.
我在上面的模块上输入了密码,所有数据库的r都设置为1.
I put in the keycode on the above module and all the databases r set to 1.
我的登录代码是:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Partial Class callreport
Inherits System.Web.UI.Page
Private CustomersReport As ReportDocu发送
Partial Class callreport
Inherits System.Web.UI.Page
Private CustomersReport As ReportDocument
Private Sub ConfigureCrystalReports()
Dim myConnectionInfo作为ConnectionInfo = New ConnectionInfo()
myConnectionInfo.DatabaseName =" misinfo"
myConnectionInfo.UserID =" web" ;
myConnectionInfo.Password =" web"
myConnectionInfo.ServerName =" misinfo"
Private Sub ConfigureCrystalReports()
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.DatabaseName = "misinfo"
myConnectionInfo.UserID = "web"
myConnectionInfo.Password = "web"
myConnectionInfo.ServerName = "misinfo"
CustomersReport = New ReportDocument()
Dim reportPath As String = Server。 MapPath(" crystalreport1.rpt")
CustomersReport.Load(reportPath)
CrystalReportViewer1.ReportSource = CustomersReport
SetDBLogonForReport(myConnectionInfo,CustomersReport)
End Sub
CustomersReport = New ReportDocument()
Dim reportPath As String = Server.MapPath("crystalreport1.rpt")
CustomersReport.Load(reportPath)
CrystalReportViewer1.ReportSource = CustomersReport
SetDBLogonForReport(myConnectionInfo, CustomersReport)
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo作为ConnectionInfo,ByVal myReportDocument作为ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables
For myTable作为CrystalDecisions.CrystalReports.Engine.Table in myTables
Dim myTableLogonInfo作为TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables
For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
受保护的子Page_Init(ByVal sender As Object,ByVal e As System.EventArgs)处理Me.Init
'ConfigureCrystalReports()
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
'ConfigureCrystalReports()
结束Sub
受保护的子Page_Load(ByVal sender As Object,ByVal e As System.EventArgs)处理Me.Load
'Response.Write(Request.QueryString(" rpt")))
ConfigureCrystalReports()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Response.Write(Request.QueryString("rpt"))
ConfigureCrystalReports()
End Sub
End Class
End Sub
End Class
请帮助。
推荐答案
谢谢,
SMA
这篇关于无法打开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!