SQLQueryString - where to find

Posted on 2004-09-02
Last Modified: 2008-01-09
Hi all

Have downloaded a trial copy of CR10 to use within .NET. I have a page which reads a session based xml document containing the report file and any parameters to pass in. One of the reports that will be loaded in the viewer is causing a bit of a headache. It takes 13 parameters, but needs to ignore any blanks and link in an additional table when one is set to a certain value (for a major speed boost). This can't be done 'normally' and the report takes a ridiculous amount of time to run. I have used a dataset in the past, which works very quickly as I can create a very efficient SQL statement based on the parameters in the xml. Unfortunately, I have just been informed that  our customers all have different criteria for what they want displayed (even though it is invoked from the same page). So I can no longer use a dataset. The plan now is to create the customers reports with no selection criteria and then manually change the where clause of the sql (all the query fields are in the same master table) at runtime. I have no problem with doing this, but I can't find the report class which contains the SQLQueryString - in the help file it gives no reference to the dll, namespace and class where the 'Report Object' can be found (their developer help is a pile of crap tbh). I've been using ReportDocument but it doesn't have this property anywhere. Can anyone advise me which class I should be using and what dll I need to reference in order to access it?

Thanks in advance.
Question by:Trotters
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 42

Expert Comment

ID: 11962234
Why not just filter your dataset at runtime and pass it (or a subset of it) to the report as you've been doing?

Author Comment

ID: 11962299
That would require code changes and a re-build every time it is deployed to a new customer or an existing client required output change. Reports can be easily updated, which is why I want to take this approach. It would be easy if the documentation was up to scratch.
LVL 42

Expert Comment

ID: 11963489
In that case I believe you want the recordselectionformula:

   Report.RecordSelectionFormula = "{Orders.ID} = 1"

This isn't a direct change of the SQL, but the record selection is converted into the SQL's "where" clause so it should work for you need.

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.


Author Comment

ID: 11963584
Thanks for trying, but I do need to edit the SQL. I have to reference another lookup table when a certain parameter is set, so the record selection cannot help with that. If it wasn't for that then yes I could just change the selection criteria. I just need to find the 'Report Object' class which this extract of the developer help is pointing at:

"A report corresponds to a print job in the Crystal Report Engine. When the report object is destroyed, or goes out of focus, it closes the print job. It holds on to Application Object. When a Report Object gets destroyed, it releases the application.

Access to the Report Object is dependent on the object variable you create. If the object variable goes out of scope, you will lose access to the Report Object and, therefore, the report. You may want to declare your Report Object variable as Global."
LVL 42

Accepted Solution

frodoman earned 250 total points
ID: 11963659
As far as I know this just isn't possible.  I found that documented for CR9 ( ).  I haven't seen anything documented for 10 but since it wasn't supported in 9 and there's nothing to indicate otherwise I have to believe 10 can't handle it either.

I understand why you wanted this approach vs. recompiling for each client but unfortunately I believe that would be your only option to accomplish what you need.

Author Comment

ID: 11963876
Cheers, since it has been present in reports since at least version 8.5 then as you say it's probably a limitation of their component. 'Advanced Developer Edition' my arse.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question