Question : DateTimePicker in ReportViewer

I am trying to add the DateTimePicker to my report, the SQL query will run in the configuration wizard but not on the report.

Please help if you can.

Here is what I have:

I am using VB 2005 ReportViewer  
I have a dataset  tableadapter  that queries a SQL db
------------------------------------------
On my report page I have two DateTimePicker

DateTime1_Start
DateTime2_End
-------------------------------------------
My TableAdapter SQL Statement:

SELECT        AVG(Unit) AS AUnit, AVG(StandardUnits) AS SUnits, AVG(Case) AS ACase , Shift, LineNumber,

FROM            Line2Data

WHERE        (DateAndTime BETWEEN @DateAndTime1_Start AND @DateAndTime2_End)

---------------------------------------------
My Report VB code:

Private Sub DateAndTime1_Start_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateAndTime1_Start.ValueChanged
       
Me. Line2DataTableAdapter.Fill(Me.L2ReportDataset.Line2Data, DateAndTime1_Start.value, DateAndTime2_End.Value)

        Me.ReportViewer1.RefreshReport()
    End Sub

-----------------------------------------------
 

Answer : DateTimePicker in ReportViewer

Ok, if you think the problem is in the VB code then lets use some simple stuff to check what you are sending to the database. Instead of:

Me. Line2DataTableAdapter.Fill(Me.L2ReportDataset.Line2Data, DateAndTime1_Start.value, DateAndTime2_End.Value)

Assign values to variables and look at them before passing:

sLine2Data = Me.L2ReportDataset.Line2Data

sDateAndTime1_Start = DateAndTime1_Start.value

sDateAndTime2_End = DateAndTime2_End.Value

Debug.Print sLine2Data & "|" &  sDateAndTime1_Start & "|" &  sDateAndTime2_End

Me. Line2DataTableAdapter.Fill(sLine2Data , sDateAndTime1_Start, sDateAndTime2_End)

This should eliminate the obvious in anycase.

leonstryker

Random Solutions  
 
programming4us programming4us