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

i am using vb.net windows application with ms access.
in my application i am generating report based on two date comparision.
in my databse that date field has date dataype.
in my report parameter i define that parameter as date type also.
but when i assign that parameter to my report datetime picker control like this :


VB
Dim parameters(1) As ReportParameter

     parameters(0) = New ReportParameter("customer", cmbname.Text)
     parameters(1) = New ReportParameter("fromdate", dtpfrom.Value)
     Me.ReportViewer1.LocalReport.SetParameters(parameters)



so it will creata a blank report the reason is "dtpfrom.value" is pass value as string and compare with databse date field but in databse it will find date field with date type so it will not compare or match with it so it will not convert string to date. i already tried cdate, convert.todate, .tostring("mm/dd/yyyy") but no one work.

so please anyone tell me how to do this..please its urgent if any one have idea then tell me soon,




Thank you so much
Posted

1 solution

When you convert to a date as string ALWAYS use the format "yyyy/mm/dd" because that's the only format that doesn't have a counter version with day and month swapped etc... Where I come from (Netherlands) we write the date as dd-mm-yyyy and have the day and month simply swapped and with dashes instead of slashes. In Excel this also does the trick when having to work with different regional settings. Give it a try and I think it just might work :)

Good luck!
 
Share this answer
 

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