cancel
Showing results for 
Search instead for 
Did you mean: 

VB.net/Crystal XML Data Source Syntax Question

Former Member
0 Kudos

I have a report using XML data sources (files). The report works fine in Crystal. The report contains a few subreports. Can someone help me w/ the syntax to load/run the report and pass the data source filenames? I have only seen examples of a single data source.

Thanks!

Ed

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

You do not mention how the reports are connecting to you XML data source. There are four possibilities:

1) ODBC

2) Using the crdb_adoplus.dll

3) Creating an ADO .NET dataset and passing that to the report

4) Using crdb_xml.dll

Of the four possibilities above, I'd highly discourage you from using crdb_xml.dll as this dll is not intended to be used in .NET apps. It is possible to do, but the headaches this will potentially cause you may require a rethink...

In any case, please provide the info re. how you are connecting to the XML, version of CR used and version of .NET used.

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup

Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorry for not being clearer.

The report is written in Crystal version XI. I am using Visual Studio 2010.

I am bringing the XML files into datatables before using them.

This code is somewhat working:

Dim cryRpt As New ReportDocument

Dim rs1 As DataTable

rs1 = New DataTable

rs1.TableName = "CompanyInfo"

rs1.ReadXmlSchema("companyinfo.xml")

rs1.ReadXml("companyinfo.xml")

cryRpt.Load("Report.rpt")

cryRpt.SetDataSource(rs1)

cryRpt.Refresh()

Before running the above code (which is part of a button), I can change the XML file and the report does update. However, how do I now do this for other xml sources in the report? I have another table on the main report and xml files on a few subreports.

Thanks!

former_member183750
Active Contributor
0 Kudos

1) CR XI is not supported in VS2010, only CRVS2010 is:

http://www.sdn.sap.com/irj/sdn/crystalreports-dotnet

2) Looks like your report is using crdb_xml.dll. As motioned in my previous post, absolutely not recommended. The crdb_xml.dll is dependent on the Java framework. Thus when you deploy the app, not only do you have to ensure that the .NET framework is installed, but you also have ensure that the Java framework is installed and only then can you install the CR runtime. See the blog [How to deploy Crystal Reports 2008 runtime for .NET when the report is connecting to XML files|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13732] [original link is broken] [original link is broken] [original link is broken]; for more details.

My recommendation would be to read the XML and create an ADO .NET dataset off of that, then point the report at the dataset. See the sample app vbnet_win_adodotnet.zip from [this|http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples] link.

If you really, really want to use crdb_xml.dll, see KB #1203980 - [How to change the location of the .XSD and .XML files at runtime in a .NET application|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233303333333933383330%7D.do]

- Ludek

Former Member
0 Kudos

I am even more confused now....

I get that using an XML file for the source of data for the report is not best practice. No problem.

My VB app creates data tables which is what I want to be in the Crystal report.

I tried to go through the sample code but the ADO stuff hits a SQL table.

I tried to create a dataset within the VB app by adding a dataset item and adding a table to it.

The problem I am having now is getting the report to see the datatables I have in memory.

Is there a sample of that or can you point me in some direction.

This is getting really frustrating! (just venting here).

Thanks so much!

Ed