Alex

Alex

  • NA
  • 13
  • 0

Print EXISTING Crystal Report based on stored procedure with a parameter

Mar 23 2009 11:30 AM

Hello everybody,

My task is to run EXISTING Crystal Report from some application.  I have already working solution, which uses Crystal Report SDK, but on some reason I need to be able to run it using C#.  These EXISTING Crystal Reports are based on stored procedures and all stored procedures have one parameter.  After I add all required info (logon info, parameter info) into ReportDocument class, assign it as a source to CrystalReportViewer and run it, nothing comes out, I mean print/preview resulting in just completely white sheet of paper.  There are no complaints regarding logon info or parameter not set, just nothing comes out.  If I’m using same C# code to run the report, which is not based on stored procedure, my C#code works fine.  Running of the SQL profiler provides some info, which may give some hints for knowledgeable person J.  Here is the info I can see running the profiler:

 

Working Crystal SDK version produces the following line in SQL Profiler: (TextData columnt)

 

exec sp_someReportBasedStoredProcedure ‘paramValue’

 

If I’m calling same report from C#, I’m getting the following line:

 

exec “sp_someReportBasedStoredProcedure”

 

One can notice two major differences:

 

in C# case, which is not working, 1) the name of the stored procedure is in double quotes, and 2) the parameter value is missing.

 

If somebody can help, but will require my code (how I’m setting logon and parameter info), I’ll be glad to provide it in my next post.

 

Thanks in advance,

Alex