I'm newbie to vb.net. Now I'm on report viewer component. I'm just trying to generate reports. It's okay with select data from one data table of mysql. But now I trying it advanced.
I try to generate report data from two data tables.
This is query I tried. It show result on mysql query browser.
select loan.loan_id,loan.customer_name,loan.total_amount,sum(settlement.amount) as 'Total Received',(loan.total_amount-sum(settlement.amount))as 'Total Due' from loan join settlement where loan.loan_id='" & ComboBox1.Text & "';
I made data table on dataset. which name 'due' and connected it to report viewer.
I'm not sure about my dataset's data table. because I'm new. So help me.
I named data table 'due' and add which columns select from two tables to one data table.
In addition I post my report viewer code below :
Private Sub reportby_lid()
Dim ds As New DataSet
Dim dt As New DataTable
Dim RpDs1 As New Microsoft.Reporting.WinForms.ReportDataSource
Dim SQL As String = "select loan.loan_id,loan.customer_name,loan.total_amount,sum(settlement.amount) as 'Total Received',(loan.total_amount-sum(settlement.amount))as 'Total Due' from loan join settlement where loan.loan_id='" & ComboBox1.Text & "';"
Dim da As New MySqlDataAdapter(SQL, con)
da.Fill(ds, "Due")
dt = ds.Tables(0)
ReportViewer1.Reset()
ReportViewer1.LocalReport.DataSources.Clear()
RpDs1.Name = "DataSet1"
RpDs1.Value = dt
ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
ReportViewer1.LocalReport.ReportPath = System.Environment.CurrentDirectory + "\Report5.rdlc"
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables(0)))
ReportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth
ReportViewer1.RefreshReport()
End Sub
So I gived full of my informations. Please help me guys :)