crystal reports selection formula and sql query in c#

i'm using crystal reports that comes bundled with visual studio 2005

im passing a selection formula to the crystal reports using the codebehind c# of
in this selection formula im passing a date range and a range of figures
how do i get to display this in the crystal report itself [on the rpt page] ?

also, after i finish designing the report using the wizard [form groups, add formulas, etc] ... during checking the sql query, i see the order by clause. i think this causes a lot of slow down while generating the report. is there any way to remove the order by clause?
Who is Participating?
James0628Connect With a Mentor Commented:
I haven't used that version of CR, so I don't know what the designer is like, but the basic way to show a parameter on a report is just to drag and drop it on the report.  However, if the parameter accepts ranges or multiple values, that won't work.  For a parameter that accepts a single range, you can create formulas like the following and put those on the report:

// start date
Minimum ({?date parameter})

// end date
Maximum ({?date parameter})

 Or, you can get a little more sophisticated and do some formatting in a formula, like:

"From " + CStr (Minimum ({?date parameter}), "dd/MM/yyyy") +
 " to " + CStr (Maximum ({?date parameter}), "dd/MM/yyyy")

 Change the date formatting as you see fit.  Look for CStr in the CR Help to see a list of formatting codes.

 If your parameters allow multiple values, that gets more complicated.  You can see some example formulas to handle that kind of thing at:

 As for the "order by" thing, if that's in your SQL query, I'm not sure that you want to get rid of it.  It's usually a good thing.  But if you do, you can see if you have a File > "Report Options" item in the designer.  If so, see if there is a "Use Indexes Or Server for Speed" option there.  If it's checked, you can try unchecking it and see what happens.  In a quick test I just did here using CR 10, that got rid of the ORDER BY clause that was in my SQL query.  But, like I said, that's usually something that you would _want_ sent to the server.

RakeshBhandariAuthor Commented:
thank you!
You're welcome.  Glad I could help.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.