How do I Filter a ReportViewer through a Form?
For example, I would like to choose a Date from a Form and then use this Date to filter the ReportViewer. Any idea?
E.g
Public Class frmPatientsDetailsMasterReport
Dim sql As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnViewReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewReport.Click
'TODO: This line of code loads data into the 'HospitalManagementSystemDataSet.tblPatientEntry' table. You can move, or remove it, as needed.
Me.tblPatientEntryTableAdapter.Fill(Me.HospitalManagementSystemDataSet.tblPatientEntry)
Me.ReportViewer1.RefreshReport()
End Sub
End Class
TannerPosted Dec 11, 2011, 2:50 AM
SELECT "column_name"
FROM "table_name"
WHERE "column_name" BETWEEN 'value1' AND 'value2'
You can go to this page to view examples.
Mayur DighePosted Sep 7, 2011, 10:34 AM
your SQL Query is not written properly, please correct it as follows.....
sql = "SELECT * FROM tblPatientEntry WHERE RegistrationDate BETWEEN '" & DateTimePicker1.Value & "' AND '" & DateTimePicker2.value & "'"
Note:- in above sql query values of DateTimePicker are passed as String DataType, so please ensure DataType Attribute of the Field of desired table and passing values from DateTimePicker Control.
More Information about BETWEEN Condition of SQL