Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the stored procedure that a Crystal Report is using

I need to retrieve the name of the stored procedure that a crystal report is running. Is there any way to do this in C# using the CrystalDecisions.CrystalReports.Engine.ReportDocument object?

I can't seem to find a property that will give me the stored procedure name.

Is this even possible? I've been through almost all the properties I can think of. The DataDefinition object has collections for the Formula, Parameter, Group Name, and Running Total Fields, but not one for the Database Fields.

Edit: I need to do this programatically, as I have a lot of reports. I need the option of skipping the actual running of the report and just executing the stored procedure that the report would have used. So when the report information is inserted into the database using the program, I want to be able to pull out its stored procedure and store that information separately.

like image 914
Brandon Avatar asked Mar 25 '10 17:03

Brandon


People also ask

How do I view stored procedure data?

To view the definition a procedure in Object ExplorerIn Object Explorer, connect to an instance of Database Engine and then expand that instance. Expand Databases, expand the database in which the procedure belongs, and then expand Programmability.

Can Crystal Reports run a stored procedure?

Using a Stored Procedure in Crystal Although we can't make the above query into a database view, we can incorporate it into a stored procedure that returns a result set and then feed that stored procedure into Crystal no differently than we would feed a query based on views or tables.

How do I view code in Crystal Report?

In SSRS RDL file you can right click in Visual studio and click view code. there you can see any VB code that may apply, any grouping , formula ect.


2 Answers

You're going to kick yourself. The SP's are in...

ReportDocument.Database.Tables

DataBase

then Table.Location

Table

also don't forget about SubReports...which is another collection of ReportDocuments.

like image 140
dotjoe Avatar answered Sep 25 '22 16:09

dotjoe


You can use SQLServer Profiler to capture what stored procedure is being called when you run the crystal report.

First, you need to have the right privileges to run profiler.
Second, you need to start trace and immediately execute the report.
Third, stop the trace & scan to see the name of the stored procedure(s) the report executed.

like image 32
SoftwareGeek Avatar answered Sep 22 '22 16:09

SoftwareGeek