More newbie Web service/XML questions (please bear with me!)

  • Thread starter Thread starter Bryan Dickerson
  • Start date Start date
B

Bryan Dickerson

New (first) web service is working. The following statement

Dim oC As New localhost.Service1
txResults.Text = oC.GetAllContacts(txCICust.Text, txCIType.Text)

.... returns a nice XML string that has 4 <Table>... </Table> specifications
in it. Great. So why do the following statements

Dim oC As New localhost.Service1
Dim oSR As System.IO.StringReader
Dim oXML As New DataSet

oSR = New System.IO.StringReader(oC.GetAllContacts(txCICust.Text,
txCIType.Text))
oXML.ReadXml(oSR)
txResults.Text = "Found " & oXML.Tables.Count & " record(s)."

.... return a message that says "Found 1 record(s)." Is it something to do
with the way I'm reading the XML String? I figure it has to be, but I guess
I'm lost as to why.
 
June 16, 2005

Actually, it has to do with the way that the data in a dataset is
represented. When logically you would think the data would look like:

<TableName>
<Row>...</Row>
<Row> And more rows
</TableName>

Rows are actually represented by

<TABLENAME> ' Each element with the same table name = a new row
<COLUMNNAME> ' Each sub-element = a new column
</ColumnName>
</TableName>

Therefore if your xml is returned as:

<CustomersTable>
<Firstname>.... name1
<LastName>... name1
</CustomersTable>

<CustomersTable>
<Firstname>.... name2
<LastName>... name2
</CustomersTable>

Then it would be interpreted as ONE table with 2 rows with the column's data
represented by the sub elements. I hope this makes sense and if not, then
just ask again! :-) Hope this helps and have a great day!
--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.35.110.42
Dynamic IP -- Check here for future changes
 
Back
Top