在GridView中生成带有选定行的Crystal报表

时间:2019-03-22 06:33:19

标签: asp.net vb.net gridview crystal-reports

我有一个GridView,我将其命名为“ gvPersonnelEquipment”。我在GridView上方有一个名为“ Generate Report”的LinkBut​​ton。现在,我要在此处执行的操作是,当单击GridView中的项目时,我想在Crystal Report中显示该行。现在使用我的代码,我只能在GridView中显示第一项。是否创建另一个RowCommand来处理此问题?这是我到目前为止的内容:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Dim cryRpt As New ReportDocument
    Dim crtableLogoninfos As New TableLogOnInfos
    Dim crtableLogoninfo As New TableLogOnInfo
    Dim crConnectionInfo As New ConnectionInfo
    Dim CrTables As Tables
    Dim CrTable As Table

    cryRpt.Load(Server.MapPath("PersonnelListingReport.rpt"))

    With crConnectionInfo
        .ServerName = "0.0.0.0"
        .DatabaseName = "testDB"
        .UserID = "test"
        .Password = "test"
    End With

    CrTables = cryRpt.Database.Tables
    For Each CrTable In CrTables
        crtableLogoninfo = CrTable.LogOnInfo
        crtableLogoninfo.ConnectionInfo = crConnectionInfo
        CrTable.ApplyLogOnInfo(crtableLogoninfo)
    Next

    CrystalReportViewer1.ReportSource = cryRpt
    CrystalReportViewer1.RefreshReport()


End Sub

结束班级

0 个答案:

没有答案