Skip to Content
avatar image
Former Member

How to retrieve raw SQL query from report template

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

Add comment
10|10000 characters needed 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.

  • Former Member

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

  • Get RSS Feed

1 Answer

  • Best Answer
    Jun 08 at 05:29 PM

    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

    Add comment
    10|10000 characters needed characters exceeded