rainforestnet / CrystalReportsNinja

A small Windows Console App that loads external Crystal Reports file, takes parameter inputs and export to various format or even print to printer
http://www.rainforestnet.com
94 stars 78 forks source link

Calling CrystalReportsNinja.exe from TSQL #6

Closed neo2011 closed 6 years ago

neo2011 commented 6 years ago

Thanks for your help last time.

I don't have problems running the CrystalReportsNinja from command prompt (cmd) .

However my intention is to schedule the run via sql jobs using the following commands

EXEC master..xp_cmdshell "net use t: \\Deployment /persistent:yes" EXEC master..xp_cmdshell 't:\CrystalReportsNinja.exe -F SM_AO_Invoice.rpt -O SM_AO_Invoice -E pdf' EXEC master..xp_cmdshell "net use t: /delete"

The output for line 2 is the following Exception;

Exception: Load report failed. Inner Exception: System.Runtime.InteropServices.COMException (0x80041811): Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack. at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() NULL

I read somewhere that this only happens when the report file (.rpt) is opened by another process. But i am sure I do not have it opened anywhere else.

Has anyone encounter this kind of problem. What are the possible workaround to achieve the same goal which is scheduling the run.

neo2011 commented 6 years ago

I tried using Windows Task Scheduler and it ran well......Thanks folks!!!