生成水晶报告时数据库登录失败问题。我在生成水晶报告时遇到问题 [英] Database logon failed problem while generating crystal report. I have problem in generating crystal report
问题描述
导入CrystalDecisions.CrystalReports.Engine
导入CrystalDecisions.Shared
导入连接
导入System.Data.SqlClient
导入System.Data
导入System.Configuration
部分类crystalreportforfeedack
继承System.Web.UI.Page
受保护的子Page_Load(发件人作为对象,e作为System.EventArgs)处理Me.Load
'Dim mylogin作为CrystalDecisions.Shared.TableLogOnInfo
Dim reportpath,查询为字符串
Dim report As ReportDocument
Dim err1 As SqlParameter = New SqlParameter(@ sqlerror,SqlDbType.NVarChar,500)
err1.Direction = ParameterDirection.Output
尝试
query =select * from Ptyfeedback
ds = DS_Select(查询)
''mylogin.ConnectionInfo.Password =
''mylog in.ConnectionInfo.UserID =
report = New ReportDocument()
reportpath = Server.MapPath(CrystalReport.rpt)
report.Load(reportpath)
report.SetDataSource(ds)
CrystalReportViewer1.ReportSource = report
CrystalReportViewer1 .DataBind()
CrystalReportViewer1.RefreshReport()
Catch ex As Exception
MsgBox(ex.ToString,MsgBoxStyle.Critical + MsgBoxStyle.OkOnly + MsgBoxStyle.ApplicationModal,反馈模块)
结束尝试
结束子
结束类
动态地在运行时应用登录详细信息,请查看本教程。
C#Crystal Reports动态登录参数 [ ^ ]
Refer
http://crystalreporthosting.asphostcentral.com/post/Crystal-Report-Hosting-Solving-the-Login-Failed-Error-in-Crystal-Reports.aspx [<一个href =http://crystalreporthosting.asphostcentral.com/post/Crystal-Report-Hosting-Solving-the-Login-Failed-Error-in-Crystal-Reports.aspx\"target =_ blanktitle =New Window > ^ ]
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports Connection
Imports System.Data.SqlClient
Imports System.Data
Imports System.Configuration
Partial Class crystalreportforfeedack
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
'Dim mylogin As CrystalDecisions.Shared.TableLogOnInfo
Dim reportpath, query As String
Dim report As ReportDocument
Dim err1 As SqlParameter = New SqlParameter("@sqlerror", SqlDbType.NVarChar, 500)
err1.Direction = ParameterDirection.Output
Try
query = "select * from Ptyfeedback"
ds = DS_Select(query)
''mylogin.ConnectionInfo.Password = ""
''mylogin.ConnectionInfo.UserID = ""
report = New ReportDocument()
reportpath = Server.MapPath("CrystalReport.rpt")
report.Load(reportpath)
report.SetDataSource(ds)
CrystalReportViewer1.ReportSource = report
CrystalReportViewer1.DataBind()
CrystalReportViewer1.RefreshReport()
Catch ex As Exception
MsgBox(ex.ToString, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly + MsgBoxStyle.ApplicationModal, "Feedback Module")
End Try
End Sub
End Class
Apply the logon detail at runtime dynamically, check this tutorial.
C# Crystal Reports Dynamic Logon parameters[^]
Refer
http://crystalreporthosting.asphostcentral.com/post/Crystal-Report-Hosting-Solving-the-Login-Failed-Error-in-Crystal-Reports.aspx[^]
这篇关于生成水晶报告时数据库登录失败问题。我在生成水晶报告时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!