Get complete Crystal Reports SQL statement via C# code

Posted on 2007-07-19
Last Modified: 2013-11-07
In C#, (Visual Studio 2005) I need to use the native Crystal Reports objects to get the complete SQL statement as it appears when you view it in Crystal Reports.

In Crystal Reports X1, Go to "Database > Show SQL Query..." ... That is what I need to get via C# code. I can get bits and pieces of parameter info etc but I just want the whole SQL statement.

Question by:udsllc

    Author Comment

    Sorry, Meant Crystal Reports XI (11) not X1. Thanks
    LVL 42

    Accepted Solution

    Hi udslcc,

    I've been double checking this since yesterday and I've come to the conclusion that there isn't a way to get the SQL statement out.  As far as I can tell, it's built internally and isn't publically exposed...


    Author Comment

    Thanks for your time frodoman. This seems like such a simple thing. I wonder why they would not expose it. I can understand making it read-only but not providing it at all is in my opinion just wrong.
    LVL 42

    Expert Comment

    I've never gone looking for it before, but I was surprised that it wasn't exposed also...
    LVL 100

    Assisted Solution

    There used to be a property of the report object that was the SQL query.  I don't know if that will show the SQL or not.  If it does it probably will show the original query and not any modifications made from the program

    I think it is


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now