<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Client">
<xs:sequence>
<xs:element name="ID" type="xs:int" />
<xs:element name="Nom" type="xs:string" />
<xs:element name="Prenom" type="xs:string" />
<xs:element name="Tel" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Commande">
<xs:element name="Date" type="xs:dateTime" />
<xs:element name="Quantite" type="xs:int" />
<xs:element name="ClientID" type="xs:int" />
</xs:choice>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//Client" />
<xs:field xpath="ID" />
</xs:unique>
<xs:unique name="Commande_Constraint1" msdata:ConstraintName="Constraint1"
msdata:PrimaryKey="true">
<xs:selector xpath=".//Commande" />
<xs:keyref name="CommandeClient" refer="Constraint1">
<xs:field xpath="ClientID" />
</xs:keyref>
</xs:schema>
static NewDataSet BuildDataTyped()
{
NewDataSet dst = new NewDataSet();
dst.Client.Rows.Add(new object[] { 123, "Robert", "Dupont", "123456789" });
dst.Client.Rows.Add(new object[] { 456, "Pierre", "Dubois", null });
dst.Client.Rows.Add(new object[] { 789, "Paul", "Durand", "987654321" });
dst.Commande.Rows.Add(new object[] { 1230, new DateTime(2007, 06, 01), 5, 123 });
dst.Commande.Rows.Add(new object[] { 4560, new DateTime(2007, 02, 01), 2, 456 });
dst.Commande.Rows.Add(new object[] { 3210, new DateTime(2007, 05, 01), 9, 123 });
dst.Commande.Rows.Add(new object[] { 6540, new DateTime(2006, 12, 01), 7, 456 });
return dst;
}
static void DoJobNewWay4(NewDataSet ds)
var CommandesPassees = from cmd in ds.Commande
select new
CommandeID = cmd.ID,
Client = cmd.ClientRow.Nom,
Tel = cmd.ClientRow.IsNull("Tel") ? "-inconnu-" : cmd.ClientRow.Tel,
Quantite = cmd.Quantite
};
foreach (var c in CommandesPassees)
Console.WriteLine(c.CommandeID + " : " + c.Client + " : " + c.Tel + " : " + c.Quantite);