Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted
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?????
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...