Skip to Content
avatar image
Former Member

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 22, 2008 at 01:28 PM

    See [this|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do] note.

    I would also recommend that you read the following regarding distribution of the runtime. This is important as the xml driver (crdb_xml.dll) uses Java:

    Apart from the regular deployment procedure for COM/RDC/NET applications, you have to follow the additional below-given steps in the client machines.

    Install the Java (JVM) 2 Runtime Environment (this is essentially the Java Framework needed to launch the crdb_xml native driver 1.4.2 from the java sun web site at:

    http://java.sun.com/j2se/1.4.2/download.html.

    Create a java folder inside the " C:Program FilesBusiness ObjectsCommon3.0";.

    Copy over the Crconfig.xml(C:Program FilesCommon FilesBusiness Objects3.0java) file from the development machine to the deployed machine in at the following path "C:Program FilesCommon FilesBusiness Objects3.0java" path. Open the crconfig.xml ; this file in Notepad and search for the line <JavaDir>. If JRE is installed to C:Program FilesJavaj2re1.4.2_12in then the value should be look like this <JavaDir> C:Program FilesJavaj2re1.4.2_12in</JavaDir>.

    Create a folder called lib in the "C:Program FilesCommon FilesBusiness Objects3.0java".

    Copy over the entire contents of the lib folder (especially the external folder) from the development machine to the newly created lib machine on the deployed machine. The point of this is to ensure that the crconfig.xml file contains all the files here which exist at the correct path which they now should because we copied over the lib and external directories.

    Copy crdb_xml.dll, crdb_xml_res_en, and all the files with "crdb_xml_res_xx from your development machine to the deployment machine (C:Program FilesCommon FilesBusiness Objects3.0in).

    Restart your machine and try accessing your web application. The reports will show up the data without any issue.

    The above is written for CR XI release 1. You may have to adjust the path given above as you do not specify the version of Crystal reports you are using.

    Ludek

    Add comment
    10|10000 characters needed characters exceeded

    • Ok, just to make sure we're on the same page.

      Report was created off of george.xml .One of the fields has names in it. I replaced "Johnson" with "Ludek" in the aaageorge.xml. Now this is the xml that should not be used by the report as my code is pointing at george.xml in another directory. After the change in aaageorge.xml, I still get "Johnson", thus proving that the report is reading the xml from the new directory.

      I even deleted the directory that had the original xml / xsd that was used to create the report. So there is no question that the xml would be used. And I still get a report.

      Ludek