我的水晶报告中只查看了一个数据

时间:2017-09-23 03:16:06

标签: vb.net

Public Sub reportAllemp()
        Dim DataTable1 As New DataTable
        With DataTable1
            .Columns.Add("employeeid")
            .Columns.Add("pangalan")
        End With

    cmd = New OleDb.OleDbCommand("select employeeid,pangalan from employeeinfo order by employeeid", Module1.mc)
    rdr = Module1.cmd.ExecuteReader()
    DataTable1.Rows.Clear()

    Dim report1 As Boolean = False

    While rdr.Read
        report1 = True

        DataTable1.Rows.Add(rdr.GetValue(0), rdr.GetValue(1))
    End While

    If report1 = False Then
        MessageBox.Show("Unable to load report for all employees.", "", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Exit Sub
    Else
        Dim allemp As CrystalDecisions.CrystalReports.Engine.ReportDocument
        allemp = New CrystalReport1
        allemp.SetDataSource(DataTable1)
        admin.CrystalReportViewer1.ReportSource = allemp
    End If
End Sub

0 个答案:

没有答案