We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

Get complete Crystal Reports SQL statement via C# code

Medium Priority
2,012 Views
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.

Thanks
Comment
Watch Question

Author

Commented:
Sorry, Meant Crystal Reports XI (11) not X1. Thanks
Commented:
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...

frodoman

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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.

Commented:
I've never gone looking for it before, but I was surprised that it wasn't exposed also...
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
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
rptObj.SQLQuery

mlmcc
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.