Group: Forum Members
Posts: 386,
Visits: 2.1K
|
Hi Keith,
This may help.
We have a semi generic method of creating interfaces into ERP systems and gather the data into XML format and store that data in a SQL table. The table we use has column called ERXIFData and its data type is XML.
When we want to show contents of the ERXIFData we use a DevExpress grid and pass to it a dataset that has been generated from the XML data. One instance of ERXIFData could contain contain several 100 rows of data.
The code we use is:
Case clsENU.ERPIFType.ERPBoughtIn
ShowAnInterface(Me.luERX.Properties.GetDataSourceValue("ERXIFData", Me.luERX.ItemIndex).ToString, Me.GridControl9, Me.GridView9, Me.XMLDataSetBoughtIn)
Private Sub ShowAnInterface(ByVal ERXIFData As String, _
ByRef Grid As DevExpress.XtraGrid.GridControl, _
ByRef GridView As DevExpress.XtraGrid.Views.Grid.GridView, _
ByRef ds As System.Data.DataSet)
Dim objXmlNamespaceManager As New System.Xml.XmlNamespaceManager(New System.Xml.NameTable)
Dim reader As New System.Xml.XmlTextReader(ERXIFData, _
System.Xml.XmlNodeType.Document, _
New System.Xml.XmlParserContext(Nothing, _
objXmlNamespaceManager, _
"", _
System.Xml.XmlSpace.None))
ds.ReadXml(reader)
Grid.DataSource = ds.Tables(0)
Grid.ForceInitialize()
GridView.UpdateSummary()
clsFU.LocaliseAllControls(Grid)
reader.Close()
End Sub
And that's it.
The DevExpress Grid renders the columns in the dataset automatically (refer Grid.DataSource = ds.Tables(0)), i.e. we can pass any pieces of XML to the grid (including hierarchical) and it renders correctly.
To pass in the ERXIFData column we first convert it to String.
Cheers, Peter
|