Denver
Denver

Reputation: 147

Crystal Reports only shows the last column

since i am new to crystal report i have search for 3 hours still couldn't find the right answer to my problem. please check my code.

Dim rptsumrep As CrystalDecisions.CrystalReports.Engine.ReportDocument
        Dim sda As New MySqlDataAdapter
        Dim bsource As New BindingSource
        Dim dtincom As New DataTable
        dtincom.Clear()
        conn.Open()
        Dim queryIncom As String = "select *from tblbilling where date_conduct between '" & dtfrom.Value.Date.ToString("yyyy-MM-dd") & "' and '" & dtto.Value.Date.ToString("yyyy-MM-dd") & "'"
        sda = New MySqlDataAdapter(queryIncom, conn)
        sda.Fill(dtincom)
        bsource.DataSource = dtincom
        sda.Update(dtincom)
        grid.DataSource = bsource

        rptsumrep = New CrystalReport1
        rptsumrep.SetDataSource(dtincom)
        frmCrystalReport.CrystalReportViewer1.ReportSource = rptsumrep
        frmCrystalReport.CrystalReportViewer1.Refresh()
        frmCrystalReport.ShowDialog()
        frmCrystalReport.Dispose()

Questions:

  1. do i have to name my rpt field same to my datagridview column title?
  2. why is it the last column title same as my database which i rename it as "Status" but on the run time it shows "status"

Upvotes: 2

Views: 110

Answers (1)

Hoh
Hoh

Reputation: 1184

The column titles in Database and Dataset has to be the same.
Also, using Select Column1, Column2, ColumnN ... is always the better way than writing just Select * in query.
Titles should/can be edited in Report file, which will change the showing title of that column, of course the name of the column should stay as a original in Details section of report.

Upvotes: 1

Related Questions