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
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