Hi,
I am really confused. I have created a strong typed dataset for Northwind
database Customer table. Now I am loading it with a stream of XML (ADO style)
with the following:
Customers _cust = new Customers();
XmlTextReader xmlReader = new XmlTextReader(stream);
stream.Position = 0;
_cust.ReadXml(stream, XmlReadMode.InferSchema);
Debug.Write(_cust.GetXml());
/* -- Debug.Write(_cust.GetXml()); --
<xml>
<rs:data xmlns:rs="urn:schemas-microsoft-com:rowset">
<z:row CustomerID="ALFKI" CompanyName="Alfreds Futterkiste"
ContactName="Maria Anders" ContactTitle="Sales Representative" Address="Obere
Str. 57" City="Berlin" PostalCode="12209" Country="Germany"
Phone="030-0074321" Fax="030-0076545" xmlns:z="#RowsetSchema" />
<z:row CustomerID="ANATR" CompanyName="Ana Trujillo Emparedados y
helados" ContactName="Ana Trujillo" ContactTitle="Owner" Address="Avda. de la
Constitución 2222" City="México D.F." PostalCode="05021" Country="Mexico"
Phone="(5) 555-4729" Fax="(5) 555-3745" xmlns:z="#RowsetSchema" />
<z:row CustomerID="ANTON" CompanyName="Antonio Moreno TaquerÃ*a"
ContactName="Antonio Moreno" ContactTitle="Owner" Address="Mataderos 2312"
City="México D.F." PostalCode="05023" Country="Mexico" Phone="(5) 555-3932"
xmlns:z="#RowsetSchema" />
</rs:data>
</xml>
*/
The problem is that I am getting no values in none of the rows:
foreach(DataRow dr in _cust.customers.Rows)
{
//-- NO VALUES
Debug.Write(Convert.ToString(dr[0]));
}
On the other hand I get all the column names using the following:
foreach(DataColumn dc in _cust.customers.Columns)
{
//-- I get each column name
Debug.Write(Convert.ToString(dc.ColumnName + "\r\n");
}
So how do I load the values into the typed dataset? Then access them to
modify a value... For example a column containing the date may need to be
modified before displaying it into a report.
REMARK: _cust.customers.Rows.Count return 0 while actually as we can see
above there are 3 rows.
Please help me!
~yamazed