General information
Title:
No output - CR8.5 report with stored procedure with params
Environment versions
Network:
Windows 2000 Server
I am trying to execute a crystal report (8.5) with an sql server stored procedure as the datasource
The code below runs with no errors - but I get no output. I am thinking that the return values should not be null (see my comments in the code)
When I get to the printout() method - it first brings up the printer dialog box for my cute pdf writer
Then once that is dispatched it brings up a dialog box for the report parameters
(not sure why - when I set them with setcurrentvalue - but maybe I did this wrong as well)
Then I click OK on the parameters dialog box - but nothing happens. No errors, but no output.
This code works when I use my own report which uses a stored procedure without parameters. So the connection logic/code is
good, I think.
I know there is an addstoredprocedure method - but I am unclear on how to use it/if it is necessary.
set Step On
public oCR AS CRAXDRT.Application
public oRpt AS CRAXDRT.Report
public oDB AS CRAXDRT.Database
public ocDBT AS CRAXDRT.DatabaseTables
public oDBT AS CRAXDRT.DatabaseTable
oCR = CREATEOBJECT("CrystalRuntime.Application")
*oRpt = oCR.OpenReport("C:\amsql\crystal\ar\arcust.rpt")
oRpt = oCR.OpenReport("e:\budsvamsql\crystal\ar\arcust.rpt")
* Create the Database object
oDB = oRpt.Database()
* Get a references to the DatabaseTables collection
ocDBT = oDB.Tables()
* Get a reference to the DatabaseTable object for table 1
oDBT = ocDBT.Item(1)
*-- definition for the stored procedure
*ALTER procedure vsp_rpt_arcust @csortby varchar(250), @cfilter1 varchar(250),
*@cfilter2 varchar(250), @cfilter3 varchar(250), @linclecaddr smallint,
*@lnotepad smallint, @csortno varchar(250)
orpt.ParameterFields.Item(1).SetCurrentValue("arcust.ccustno")
orpt.ParameterFields.Item(2).SetCurrentValue("")
orpt.ParameterFields.Item(3).SetCurrentValue("")
orpt.ParameterFields.Item(4).SetCurrentValue("")
orpt.ParameterFields.Item(5).SetCurrentValue(0)
orpt.ParameterFields.Item(6).SetCurrentValue(0)
orpt.ParameterFields.Item(7).SetCurrentValue("1,2")
* Set the location
* This one works for a DSN
*odbt.SetLogOnInfo("mssql_vam","sample","vamlogin","go")
ln_ret1= ocr.logonserver("p2sodbc.dll","mssql_vam","sample","vamlogin","go") &&returns null -
IF oRPt.HasSavedData
oRPT.DiscardSavedData()
ENDIF
ln_ret3= oRpt.PrintOut() && returns null
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only