Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Report = IniReadPvt ('CrysArch', 'Report',' ', 'C:\Parameter.ini') Destination = IniReadPvt ('CrysArch', 'Destination',' ', 'C:\Parameter.ini') ;write pdf file cra = objectopen("CrystalRuntime.Application") cra.LogOnServer("PDSODBC.DLL","C.dsn","C:\","","") cra.LogOnServer("PDSODBC.DLL","CWAcctg.dsn","G:\CWACCTG\","","") cra.LogOnServer("PDSODBC.DLL","cwslib.dsn","G:\cwslib\","","") ;open the saved report crr = cra.OpenReport(Report) cre = crr.ExportOptions hfile = Destination cre.DestinationType = 1 ;diskfile cre.FormatType = 31 ;24=html 31=pdf cre.DiskFileName = Destination cre.PDFExportAllPages crr.Export(@false) objectclose(cre) objectclose(crr) objectclose(cra)I receive Error 1261: Ole:Exception On Line:
crr.Export(@False)
The OLE exception can indicate that the object is unhappy with some aspect of one or more of the parameters that you passed to any of the methods preceding the call to the "export" method. Because of a lack of knowledge of the Crystal Reports object model, I will not attempt to guess which is the offending parameter.
Check if the script is successfully reading the Report and Destination values from the 'c:\Parameter.ini' file.
DebugTrace is useful.
I have found something: Before my original post, I unsucessfully tried the script using several different reports. However, I just stumbled upon a report with which the original script does work. I'm directing my efforts towards determining the difference between the report that works and the reports that do not.....
MORE: One of my problems was a Crystal v10 report with a v8.5 subreport. The subreport was only a small portion of the whole report, and therefore easy to miss.
============================================ Report = IniReadPvt ('CrysArch', 'Report',' ', 'C:\Parameter.ini') Destination = IniReadPvt ('CrysArch', 'Destination',' ', 'C:\Parameter.ini') ;write pdf file cra = objectopen("CrystalRuntime.Application") cra.LogOnServer("PDSODBC.DLL","C.dsn","C:\","","") cra.LogOnServer("PDSODBC.DLL","CWAcctg.dsn","G:\CWACCTG\","","") cra.LogOnServer("PDSODBC.DLL","cwslib.dsn","G:\cwslib\","","") crr = cra.OpenReport(Report) cre = crr.ExportOptions cre.DestinationType = 1 ;diskfile cre.FormatType = 31 ;24=html 31=pdf(hopefully) cre.DiskFileName = Destination cre.PDFExportAllPages crr.Export(@false) objectclose(cre) objectclose(crr) objectclose(cra) ============================================
Here's the thing: I don't know what changed!
If I attempt to run the exe compiled many months ago, it runs fine. But if I run it from studio, or compile it again, it fails on the export with: "failed to login user blah blah".
Versions of crystal are same, winbatch program same, can't figger what's different!
I know there's nothing here to go on, just thought I'd chip in with the fact that I too am seeing something funny on the crystal Export method.
[COM Exception] Crystal Reports ActiveX Designer=Logon failed. Details: 28000:[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'worker'. [COM Sub-system] Function=InvokeMember ErrorCode=9 (0x80020009) ErrorDesc=Exception occurred."worker" is the user name, specified earlier in the LogOnServer call. I know it looks like a simple bad password, but I swear I've tested for that. The same user/pass works well when specified directly within crystal, in the older exe, and other situations. I do know that it sees the sql server because if I intentionally misspell the database name, I get a different error.
WAIT A MINUTE .... MIGHT HAVE SOMETHING...
I GOT IT. The user above was right ==> it's all about subreports. In his case, his nested subreport was from ver8.5, but running inside a ver10.0 report.
In my case, the subreport is from *an earlier setting of the ODBC DSN*. If the DSN is set back the was it was when the report was compiled, it runs OK.
In other words, the main report supports changing DSN info at runtime, but the nested subreports do not.
I can make this program run fine, if I use the old DSN settings. The "thing that changed" was the definition of the ODBC DSN.
Thanks for everyone's help. I would have wandered in the weeds for days without your pointed questions.
Article ID: W16578
File Created: 2005:02:18:12:21:32
Last Updated: 2005:02:18:12:21:32