crystal reports runtime xml datasource

grimmersnee

Member
Joined
Dec 17, 2002
Messages
7
Hi,

I have a problem.
I have used the readxml method to read the contents of an xml file into a dataset using vb.net and I now want to pass this datasource into a crystal report. Upon creating the crystal report it asks from which datasource I want to base the design, do I point the datasource to a schema.xsd file? I would think that I would and then by passing the xml datasource at runtime it would populate the report. But this is not working. Does anyone have some understanding of this and can critic my code, this would be much appreciated, as I am fairly to new to .net.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim crReportDocument As New CrystalReport4()
Dim dsXMLDataset As New DataSet()
Dim myTable As DataTable
Dim myRow As DataRow
Dim myColumn As DataColumn
Dim strFilePath As String

strFilePath = "c:\myData.xml"
dsXMLDataset.ReadXmlSchema(strFilePath)
crReportDocument.Database.Tables(0).SetDataSource (dsXMLDataset)
CrystalReportViewer1.ReportSource = crReportDocument
End Sub

Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load

End Sub
End Class
 
The XML Schema (.xsd) is just an outline for an XML file, telling
how nodes and attributes should be applied. The XSD file does
not actually hold any data. The XML file that uses this schema
is what contains the data.

Instead of using the ReadXmlSchema() method, try the ReadXml()
method.
 
Thanks for the reply, sorryI accidentlt posted the wrong code, it should of contained xmlread instead, I was jus playing around with different ideas before I posted. Has anyone used a runtime xml datasource for crystal?????
 
Back
Top