Skip to Content
author's profile photo Former Member
Former Member

Dynamic XML as Datasource - View in .NET CrystalReportViewer

I have Crystal Reports XI R2 Developer Edition, Visual Studio 2008. I have an XML File that has sections structured in a relational way within the file. From this file, I've built a basic schema.

First problem: Building the proper RPT file. I think using the ADO.NET (XML) connection is the best way to go here, how do I get the RPT file to recognize the schema..? Here are the options in my head:

1. Select ADO.NET(XML) connection and when it asks for file, point it to the XSD file. This loads the fields in the field explorer, with the correct datatypes. But how then do I run a preview?

2. Link the schema file inside the XML file (and every XML file that will be called dynamically). Then Select ADO.NET (XML) and point it to the XML file, I can preview, but how do I switch XML files later (see problem 2).

Second Problem: Launching CrystalReportViewer with dynamic XML datasource. What needs to be done here.. ? Do I need a Dataset in my visual studio project? Can I just use the XML / XSD / RPT combination? How to I flip the RPT to use different XML files..?

There are zero examples of this it seems. Anything will help me. Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Sep 19, 2008 at 04:42 PM

    I'd recommend using datasets at runtime. I suppose you could go off of XML directly, but I find the crdb_adoplus.dll dataset driver much more stable and reliable than the XML driver, or ODBC. Essentially, once you have a dataset do:

    crReportDocument.Database.Tables(0).SetDataSource(dataSet.Tables("NAME_OF_TABLE"))

    or, you can try to go as:

    crReportDocument.SetDataSource(dataSet) or crReportDocument.SetDataSource(dataSe.Tables(0))

    Following link is to a great White paper on how best to work with datasets and Crystal Reports:

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/401c4455-a31d-2b10-ae96-fa57af5aec20

    Ludek

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2008 at 02:58 PM

    I've been reading that VS 2008 is not directly compatible with CR XI R2, but I also have VS 2005, so my questions remain with either IDE.

    Edited by: Kurtas BB on Sep 19, 2008 4:58 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.