Please help me on how can I refresh the records displayed in my crystal report.
because when i first open a report it functions well but if I close the report viewer form then open it again the previous records will display with the new records that i selected
example if i select * from tblname name it will display:
1 |pedro |san jose
but when i close it and open it again with the same query it will now become
1 |pedro |san jose
1 |pedro |san jose
I need to close the entire project just to remove the duplicate record
what i need is like listview1.items.clear but in crystal report
this is my code
'====================this is the code to display the form where you can find the crystal report viewer====
Private Sub ButtonXView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonXView.Click
With CHDepartmentReportViewer
.ShowDialog()
.CrystalReportViewer1.Refresh()
.CrystalReportViewer1.RefreshReport()
End With
End Sub
'=====================this is the code inside my CHDepartmentReportViewer===============================
Option Strict On
Imports MySql.Data.MySqlClient
Imports CrystalDecisions.CrystalReports.Engine
Public Class CHDepartmentReportViewer
Private Sub CHDepartmentReportViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strReportName, strReportPath As String
Try
strSQL = "Select * from tbl_medicine_inventory i, tbl_medicine_brand_list b, tbl_medicine_description_list d where b.medicine_id = i.relation_medicine_id and d.medicine_description_id = i.relation_medicine_description_id ORDER BY batch_no DESC"
Connection.Open()
cmd = New MySqlCommand(strSQL, Connection)
Dim da As New MySqlDataAdapter
da.SelectCommand = cmd
da.Fill(ds)
strReportName = "CrystalReportCityHealthDepartmentIventory"
strReportPath = Application.StartupPath & "\" & strReportName & ".rpt"
Dim RptDocument As New ReportDocument
RptDocument.Load(strReportPath)
RptDocument.SetDataSource(ds.Tables(0))
'RptDocument.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape
With CrystalReportViewer1
.ReportSource = RptDocument
'.ShowRefreshButton = False
'.ShowCloseButton = False
'.ShowGroupTreeButton = False
End With
Catch ex As Exception
MessageBox.Show(ex.Message, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Finally
call_close()
End Try
End Sub
End Class
I hope I explained myself clear