views:

1037

answers:

3

I would like to extract the SQL queries from Crystal Report .rpt files, is there a way to do this?

I don't have any of the Crystal Reports products, just the .rpt files.

+1  A: 

My experience is with older versions of Crystal (8,9) - I've no idea what the file formats look like for more recent versions. However, it's worth opening the files up in a text editor just in case, but for the file formats I've seen, the query text is not accessible this way.

If I remember correctly, some versions of Visual Studio 2003 came with tools for manipulating Crystal .rpt files (but I guess this isn't of much use to you, since if you had this already, you wouldn't be asking!).

It's not a very imaginative suggestion, but perhaps your quickest route would be to download the 30-day trial version of the current Crystal Reports, and see if that will open the files for you.

Ed Harper
+2  A: 

The other way around this is if you can run the reports, you can hook up SQL Profiler to your DB and capture the incoming SQL on the database side.

Brandon
A: 

In "Crystal Reports ActiveX Designer Design and Runtime Library" (craxddrt.dll), the Report.SQLQueryString property will do what you want.

I can't seem to find an equivalent property in the .Net SDK, and believe me, I've been looking.

Craig