Print Page | Close Window

Crystal Report with XML at run time??

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=484
Printed Date: 04 May 2025 at 12:25am


Topic: Crystal Report with XML at run time??
Posted By: avnkkishore
Subject: Crystal Report with XML at run time??
Date Posted: 09 Apr 2007 at 4:23am

Hi,

I have very simple requirement.

I would like to create a crystal report using XML. This XML file will be decided at run time (not at design time).

Hence i have added a crystal report viewer control to my windows form and did not choose any data source (i left it blank currently). Now i am trying to load XML file with the following simple code.

            PropertyBag crLogOnDetails = new PropertyBag();
            crLogOnDetails["Local XML File"] = @"C:\Hosts.xml";
            crLogOnDetails["Local Schema File"] = @"C:\Hosts.xsd";

            ConnectionInfo conn = new ConnectionInfo();
            conn.Attributes = crLogOnDetails;
           
            // create "Host" table
            CrystalDecisions.ReportAppServer.DataDefModel.Table tbl;
            tbl = new CrystalDecisions.ReportAppServer.DataDefModel.Table();
            tbl.Name = "Host";
            tbl.ConnectionInfo = conn;

            rcDoc.DatabaseController.AddTable(tbl, null);

I am getting exception exactly at the above line (i.e. when adding table to Database Controller) saying "COMException was unhandled" with error code 0x80004005 Unspecified error.

Can any one please help me regarding how to resolve this.

Thanks in advance,
Kishore




Print Page | Close Window