无法对水晶报告

时间:2017-06-09 01:42:15

标签: vb.net visual-studio-2010 crystal-reports crystal-reports-viewer

  

我有一些执行水晶报告的代码到我的水晶报告查看器中,我已经设置了参数和sql,但没有显示。有谁能够帮我?我是使用水晶报告的新手

Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load
    Dim crDatabase As Database
    Dim crTables As Tables
    Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim crTableLogOnInfo As TableLogOnInfo
    Dim crConnectionInfo As ConnectionInfo
    vRptED.Load("D:\FENNY\ReportsRecon\ReportRecon\Rp11\Revisi\BLReports7RevTrial.rpt")
    crConnectionInfo = New ConnectionInfo()
    crDatabase = vRptED.Database
    crTables = crDatabase.Tables

    With crConnectionInfo
        .ServerName = "172.24.34.57"
        .UserID = "sa"
        .Password = "sa"
        .DatabaseName = "REPORTS"
    End With

    crDatabase = vRptED.Database
    crTables = vRptED.Database.Tables

    For Each crTable In crTables
        crTableLogOnInfo = crTable.LogOnInfo
        crTableLogOnInfo.ConnectionInfo = crConnectionInfo
        crTable.ApplyLogOnInfo(crTableLogOnInfo)
    Next
    connString()
    Dim sql As SqlCommand
    sql = New SqlCommand("SELECT * from PLSummary51 ", con)
    Dim ddlValues1 As SqlDataReader
    Dim ds As New DataSet
    ddlValues1 = sql.ExecuteReader
    While ddlValues1.Read
        vRptED.SetParameterValue("BisnisUnit", "51")
        vRptED.SetParameterValue("CompID", "22")
    End While        
    CrystalReportViewer1.ReportSource = vRptED
    CrystalReportViewer1.Refresh()
End Sub

0 个答案:

没有答案