Reputation: 147
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:
Upvotes: 2
Views: 110
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