I am new to VB.NET and Crystal reports however learning very quick, have a med size application to manage customers, however currently trying to generate invoice from my database
I have a database structure as follows (shortend for relevance)
client.id
client.name
client.company
client.email
invoice.id
invoice.clientid
invoice.vat
invoice.total
invoice_items.id
invoice_items.invoiceid
invoice_items.item
invoice_items.qty
invoice_items.unit
These table are related as follows
client.id <- one to many ->invoice.clientid
invoice.id <- one to many ->invocie_items.invoiceid
I have a need to create a report, which I have done however when I preview the report in VS2008 i see no data, thinking this was just a ONLY when running program issue I decided to build and run the application.
My code to load the report is
Dim strReportName As String
strReportName = "CrystalReport1"
Dim strReportPath As String = "C:\" & _
"\" & strReportName & ".rpt"
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & _
vbCrLf & strReportPath))
End If
Dim cr As New ReportDocument
cr.Load(strReportPath)
cr.SetDataSource(MassiveDataSet.Tables(0))
Form1.CrystalReportViewer1.ShowRefreshButton = False
Form1.CrystalReportViewer1.ShowCloseButton = False
Form1.CrystalReportViewer1.ShowGroupTreeButton = False
Form1.CrystalReportViewer1.ReportSource = cr
Form1.Show()
What I think i need to do is sent the invoice.id to the report so that it can run the SQL query to display the report correctly.
Any help would be very welcomed, espicially good websites / posts with either tutorials or code for similar projects which I would need to read and learn.
Im sure what I'm doing requires me specifing somewhere in the report a query which chooses what invoice.id a report is being generated for, then obviously the above code would need to be updated to represent any changes required.
Thanks
Keith