Click here to Skip to main content
15,062,997 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I am using VB.NET windows application with MS Access. In my report I have two parameters. One is 'by customer name' and other is 'by date'. I already defined parameters in report. Added parameters like: CustomerName as string and Date as datetime in it.

I use combobox for customername and datetime picker control for date.
when i just past parameter for customername in reportviewer it generates report customer wise but when i pass the date parameter it will cause an error: error during local report generating.
We get the error as it takes date as string but while in query to fecth data from database, it will not convert that string to date.

I tried so many thing for conversion but the error is same:
my code is :
VB
Dim parameters(0) As ReportParameter
parameters(0) = New ReportParameter("CustomerName", cmbName.Text)
parameters(1) = New ReportParameter("fromdate", dtpfrom.Value.ToString("MM/DD/YYYY"))
Me.ReportViewer1.LocalReport.SetParameters(parameters)

Please help me what to do.
Posted
Updated 2-Aug-10 0:12am
v2

1 solution

In the code snippet provided, you are adding the date parameter value in a specific date format, BUT still as a string.

Instead, define that parameter as DateTime type and then provide a value to it. That should work.
You can define a 'DataType' for a particular parameter. Try it.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900