Dim Report As New ReportDocument
Report.Load(Application.StartupPath & "\AppointmentTable.rpt")
Dim con As New SqlConnection("Data Source=.\sqlexpress;Initial Catalog=dataBaseName;Integrated Security=True")
Dim DataAdap As New SqlClient.SqlDataAdapter("Select Appoint_Reason , Appoint_Note FROM AppointmentTable where Appoint_Date= @Par_Appoint_Date ", con)
DataAdap.selectcommand.Parameters.Clear()
DataAdap.selectcommand.Parameters.AddWithValue("@Par_Appoint_Date1", SqlDbType. Date).Value = PDT_AppointDate1.value
DataAdap.selectcommand.Parameters.AddWithValue("@Par_Appoint_Date2", SqlDbType. Date).Value = PDT_AppointDate2.value
Dim dset As New DataSet
Try
DataAdap.Fill(dset, "AppointmentTable")
Report.SetDataSource(dset)
Catch ex As Exception
MsgBox(ex.Message)
End Try
PrintViewerForm.CrystalReportViewer1.ReportSource = Report
PrintViewerForm.ShowDialog()