Skip to Content
0

How to retrieve raw SQL query from report template

Mar 31, 2017 at 09:08 AM

60

avatar image
Former Member

A trivial .Net client, a stand alone app. HelloWorld, really.

using CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0.

Loads a template.from a file.

Is it possible to get a raw SQL query, which CR generates internally, based on the parameters of the template?

Google search has returned a few similar questions, but they all seem to refer to RAS.

Much appreciated

michael

10 |10000 characters needed characters left characters exceeded
Former Member

to elaborate further: we need to get the query from our code, not by looking at SQL Profiler or some SQL traces.

0
Former Member

this is the query which you see from the Template Designer, using Database\ShowSQLQuery menu.

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Don Williams
Jun 08 at 05:29 PM
0

You need to use RAS which is free to use.

To get it use this:

GroupPath gp = new GroupPath();
string tmp = String.Empty;
try
{
rptClientDoc.RowsetController.GetSQLStatement(gp, out tmp);
btnSQLStatement.Text = tmp;
btnSQLStatement.AppendText("\n");
}

Update runtime here:

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

Sample code above is in this test app:

https://blogs.sap.com/2016/02/17/how-to-parameters-in-crystal-reports-for-visual-studio-net/

Don

Share
10 |10000 characters needed characters left characters exceeded