Issue loading XML into datagrid...

  • Thread starter Thread starter Eddy
  • Start date Start date
E

Eddy

Hello,

I've an XML file loaded into a dataset. It works fine, but some values
i can't load. For example, <incidentid> is working fine, but
<subjectid> is an issue, because it has a name and dsc parameter. the
same count for <createdon> and <modified on>.
I want to load the dataset into a datagrid and again, without these
fields it works fine, but for whatever reason, i can't access these
different fields. I'm developing in ASP.NET/VB.NET.

Thanks for your help.

Here is my XML file:
<incidents>
<incident>
<incidentid>{6C15B06F-26F2-480E-B060-D59DEC5E2574}</incidentid>
<subjectid name="Hardware"
dsc="0">{B4E919D9-945D-43A3-88E8-2D1C25D40D27}</subjectid>
<title>Can't start my computer</title>
<description>When i want to start my computer it does not
start</description>
<createdon date="19/04/2005" time="01:27
AM">2005-04-19T01:27:04-07:00</createdon>
<ticketnumber>12302003</ticketnumber>
<modifiedon date="19/04/2005" time="01:29
AM">2005-04-19T01:29:59-07:00</modifiedon>
<statuscode name="Problem Solved">5</statuscode>
</incident>
<incident>
<incidentid>{9E7CA80E-5979-4C4F-B196-72AA6D5035A4}</incidentid>
<subjectid name="Software"
dsc="0">{8E78CD49-9B15-4706-AC52-0A28082FB80A}</subjectid>
<title>How can i copy paste in word?</title>
<description>I want to copy paste text in word, how can i do this
?</description>
<createdon date="14/04/2005" time="06:30
AM">2005-04-14T06:30:20-07:00</createdon>
<ticketnumber>12302002</ticketnumber>
<modifiedon date="19/04/2005" time="01:24
AM">2005-04-19T01:24:18-07:00</modifiedon>
<statuscode name="Problem Solved">5</statuscode>
</incident>
</incidents>
 
Observation:
i have loaded this xml into my dataset and checked the functionality.
It is basically creating 5 tables :O.
table 1: your marster table and rest all are the tables containing the
attribute values as reference tables.
To bind and display it in the grid, you need to use itemdatabound event
handler and get the data for those attributes from the corresponding tables.

The tables created in your case can be seen in this schema:
1. incident
2. subjectid
3. createdon
4. modifiedon
5. statuscode

Hope this helps!!
Ural
 
Ural,

Thanks for your reply.

I understand what you're writing here, but i've no clue how to do it.
The code i've right now is the following:
Dim docIncidents As System.Xml.XmlDocument =
xmldocIncidents.getIncidents(varAccountGUID)
Dim readerIncidents As New XmlNodeReader(docIncidents)

Dim dsIncidents As New DataSet
dsIncidents.ReadXml(readerIncidents)
readerIncidents.Close()

DGCases.DataSource = dsIncidents.Tables(0).DefaultView
DGCases.DataBind()

This all works, but only with the "master table". Do i maybe need to
change Tables(0) into Tables(1) to get to the other data ???

Thanks a lot.

Regards,

Eddy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top