hi,
I have a problem with passing the value from a Form that "user should choose a start date and end date" to a Form that display the result in a Crystal Report Form
Actually it gives this error at runtime:
"SqlDateTim e overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM"
I tested the query and it works perfect, also the form of pickers works perfect.
Thanks.
I have a problem with passing the value from a Form that "user should choose a start date and end date" to a Form that display the result in a Crystal Report Form
Actually it gives this error at runtime:
"SqlDateTim e overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM"
Code:
'The form that dates will be picked from Public Class frmBuyDate Public dateStart As String Public dateEnd As String Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowReport.Click dateStart = dpStart.Value.ToShortDateString dateEnd = dpEnd.Value.ToShortDateString 'MessageBox.Show(dateStart.ToString()) Dim objBuyRprt As New frmBuyRprt() objBuyRprt.ShowDialog() End Sub End Class
Code:
'Here, both 'dateStart' and 'dateEnd' are Null !!!!!! This is the thing I want to know , WHY I always used to do this with C# and it works, whats wrong here? Public Class frmBuyRprt Private Sub frmBuyRprt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Me.BUYSTableAdapter.FillByDate(PHARMACYDBDataSet.BUYS, Convert.ToDateTime(frmBuyDate.dateStart), Convert.ToDateTime(frmBuyDate.dateEnd)) Dim objBuyRprt As New CrystalReport1 objBuyRprt.SetDataSource(PHARMACYDBDataSet) crvBuy.ReportSource = objBuyRprt Catch ex As Exception MessageBox.Show(ex.ToString()) End Try End Sub End Class
Code:
'The Dataset Query' SELECT Med_ID, Med_Date, Med_Cat, Med_Name, Med_Qty, Med_Price, Med_TotalPrice FROM BUYS WHERE (D2 >= @startDate) AND (D2 <= @endDate) ORDER BY D2 DESC
Thanks.
Comment