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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

quotes around fromdata and todate

Status
Not open for further replies.

gagani

Programmer
Nov 20, 2011
57
GB
In the crystal report, I have added a command which extracts rows from a table of another server through openquery
select *from openquery(lnkserver,'select ltrim(rtrim(a.firstname))+'' ''+ltrim(rtrim(a.lastname)) as name from table a where a.date>={?fromdate} and a.date<={?todate} ')

It is not accepting with dates. In sql query window, if i put any date within double quotes , its working fine. But in crystal report, I tried the same with double quotes around{?fromdate} and {?todate}, but its not working.
whereever there is single quote in sql server, i have made it a double quote, but for date i am unable to implement in crystal report.
 
If the date is of string datatype, then the parameter within the command should be in single quotes: '{?fromdate}'. If it is of date or datetime datatype, then you shouldn't use any quotes.

-LB

 
it didn't work out that way. is there any other way?
 
You have to provide more information. What error message did you get? What is the datattype of a.date? How is it displayed in the report if you don't add the where clause? How did you set up the parameter? If it is a string datatype, the format must be the same for both parameter and date.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top