Redirect Datasource at runtime
Posted on 2003-12-11
I have this code in Visual Foxpro 8 :
This is an old one because it is using Automation server.
Hope you guys can show me the right coding to work with RDC.
oCRApplication = createobject("Crystal.CRPE.Application")
oCRReport = oCRApplication.OpenReport("E:\LAN Research\arcust.rpt", 1)
oCRReport.Database.tables(1).Location = "XML.myXMLFile"
ARCUST.RPT (done using CR 8.5) is an rpt whose data source is a MSSQL 2000 stored procedure with 3 stored procedure parameters.
At Visual Foxpro Environment, I have a code that converts the VFP query resultset to an XML file (MyXMLFile.xml)
The fieldnames and datatype for both MSSQL SP and XML file is exactly the same.
Now, at runtime, I'd like to change the datasource of the RPT to point to this XML file (from the previously assigned MSSQL SP at design time).
The problem is that, when I issue the code above, a window pops up which requires me to enter Parameter Values (of the 3 MSSQL SP parameters).
Since I issue the logoninfo to point to an XML ODBC and supply the Location, I thought it will automatically preview the report which will then use the XML file.
What seems to be the problem?
Please show me code lines how to correct this.
Visual Basic 6 or Delphi code lines is fine.
Thanks in advance,