全部 ...
我需要显示从 DateTimePickers 传入的两个日期之间的记录。
我得到的记录不在我从 vb.net 指定的日期之间。
请通过下面显示的代码....
以下是代码:
Private Sub btn_Show_Inquiry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Show_Inquiry.Click
report_viewer_form.Report_viewer_CrystalReportViewer1.ReportSource = Nothing
report_viewer_form.Report_viewer_CrystalReportViewer1.Refresh()
str1 = "SELECT * FROM Inquiry_Details WHERE Inquiry_Date>=#" & dtp_inq_from.Text & "# AND Inquiry_Date<=#" & dtp_inq_to.Text & "#"
If dtp_inq_from.Text > dtp_inq_to.Text Then
MessageBox.Show("FROM_DATE Must Be Less Then TO_DATE.", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If cn.State <> ConnectionState.Open Then
cn.Open()
End If
da = New OleDbDataAdapter(str1, cn)
report_dataset = New DataSet
da.Fill(report_dataset, "table2")
If MsgBox("Do You Want to Print Report ?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
report_viewer_form.Show()
Dim cr As New ReportDocument
cr = New Inquiry_CrystalReport
cr.SetDataSource(report_dataset.Tables("table2"))
report_viewer_form.Report_viewer_CrystalReportViewer1.ReportSource = cr
End If
End Sub