page_load 輸入下列程式碼:

 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的回答
文章標籤
全站熱搜
創作者介紹
創作者 冰緒雪夜 的頭像
冰緒雪夜

今宵月は何処を照らすの

冰緒雪夜 發表在 痞客邦 留言(0) 人氣(17)