Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

VB6 & XML Datasource using Native XML Driver

We used to use reports that used ADO XML dataset, and in VB 6 we easily told the report which XML file to use by:

Dim objCRReport As CRAXDRT.Report

Set objCRReport = objCRApplication.OpenReport(App.path & "\crystal\" + rptName)

objCRReport.DiscardSavedData

objCRReport.Database.Tables.Item(1).Location = xmlFile

where xmlFile was the fully qualified path to the xml data to pass to the report.

Now we are trying to do this with a new report which uses a XML Native driver as its connection method. In VB6, how can we pass different xml files to use?

We looked at objCRReport.Database.SetDataSource, but it expects some parameters that I don't understand ( data , { data type } , { table number } )

Is there an example anywhere of how to switch your datasource in code while using the XML Native Driver?

Former Member
replied

Ok. Tested and it does work.

Here is what I did.

1) Create a report off of a "george.xml"; and "george.xsd";. "george.xml"; and "george.xsd"; are in C:\crystal\xml directory.

2) Ensured that "Save data with report" was not enabled.

3) Saved report as test_xml.rpt

4) Created a simple VB 6 app to run above report - works

5) Copied "george.xml"; and "george.xsd"; to C:\Crystal\test\

5) Renamed the "george.xml"; and "george.xsd"; in the C:\crystal\xml directory to "aaageorge.xml"; and "aaageorge.xsd";

6) Used code below to view the report - no errors

Set myReport = myApplication.OpenReport(CommonDialog1.FileName)

myReport.Database.Tables(1).ConnectionProperties("local xml file") = "C:\Crystal\test\george.xml";

myReport.Database.Tables(1).ConnectionProperties("local schema file") = "C:\Crystal\test\george.xsd";

CrystalActiveXReportViewer1.ReportSource = myReport

CrystalActiveXReportViewer1.ViewReport

So, I'm not sure what the difference may be between your app and mine, but perhaps you can try to copy and paste my code into a new project and see if that will work.

A bit on the RAS thread. For my money, I'd move over to RAS. RDC (craxdrt.dll) is a retired technology. E.G.; the RDC SDK does not ship in CR 2008. I believe CR XI r2 any "official"support runs out early next year. Patch support has been stopped about 1/2 a year. Thus, from a life cycle perspective, going with RAS may be the way to go. But, this is just an FYI - cards on the table, etc. You'll have to decide what's best for your requirements.

Ludek

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question