page_load 輸入下列程式碼:
*我也將ReportViewer中的ReportSourceID關掉
資料參考:天使lala的回答
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ReportDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim logoninfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim table As CrystalDecisions.CrystalReports.Engine.Table
ReportDoc.Load(Server.MapPath("cr的檔名"))
For Each table In ReportDoc.Database.Tables
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
logoninfo.ConnectionInfo.ServerName = "您的sqlserver IP"
.UserID = "帳號"
.Password = "密碼"
End With
table.ApplyLogOnInfo(logoninfo)
Next table
CrystalReportViewer1.ReportSource = ReportDoc
Me.CrystalReportViewer1.DisplayGroupTree = False
End Sub
*我也將ReportViewer中的ReportSourceID關掉
資料參考:天使lala的回答
全站熱搜
留言列表