Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[c# asp.net] How do i pass a date parameter to crystal report

Status
Not open for further replies.

FrederikJan

Programmer
Aug 16, 2006
5
NL
Hello,

Thanks for reading my help question.

I am having the following problem: i want to pass a date parameter to my crystal report (XI, c#, asp.net 1.1.x VS 2003, mysql 5.x). In my report i have the sql command, here i want to pass 2 date parameters, the parameters are of the type Date.

when i run the report in XI and i give the parameter values (20-07-2006 eg) the report shows fine. when i pass the parameters through code, the report gives an logonfailed error. i have already noticed that that is a sign that the rpeort has no records.

the parameter in de report XI says it wants the format yyyy-mm-dd, my mysql server also wants the format as yyy-mm-dd. when i pass the values through the code is give them a string of the type "yyyy-MM-dd".

somewhere along the line XI does something with the parameters and i dont know what. i want to know how to pass the parameters correctly so i can finish my software.

please can someone shed some light over this? thanks in advance.

greets, Frederik Jan (Holland)
 
yyyy-mm-dd in a string format would be interpreted as "year-minutes-day", so you need to observe the case for the month format and use yyyy-MM-dd.

-LB
 
im sorry, i mean that all the date formats are in yyyy-MM-dd

please help...
 
If you are talking about the code used in the SQL Command, then it is dependent upon your datasource and connectivity. You could maybe check the "Show SQL Query" on another report using the same datasource to see the correct syntax for dates. I can't really help more with this, but maybe someone else can. You also might want to check a MySQL forum for the correct syntax.

-LB
 
hi there, thanx for the answer, but i dont have another report where i can look unfortunately.

there must be someone who is using dates in their reports?

im using in my sql syntax the following code:

where timestamp > '{pFrom}' // where pFrom is a report parameter of the type Date
 
Are you creating the date parameter within the command? If so, then I think you should remove the quotes.

-LB
 
yes, i use parameters in the command. ill try to remove the quotes. ill let you know.
 
when i remove the quotes i get an logonfailed error, thats strange because when i execute the report in degign time it works fine, when i use code to pass the parameters i get an error....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top