Выбрать главу

   <ord_date>1993-05-29T00:00:00.0000000+02:00</ord_date>

   <qty>25</qty>

   <payterms>Net 60</payterms>

   <title_id>PS7777</title_id>

  </Sales>

  <Sales diffgr:id="Sales15" msdata:rowOrder="14">

   <stor_id>7896</stor_id>

   <ord_num>QQ2299</ord_num>

   <ord_date>1993-10-28T00:00:00.0000000+02:00</ord_date>

   <qty>15</qty>

   <payterms>Net 60</payterms>

   <title_id>BU7832</title_id>

  </Sales>

  <Sales diffgr:id="Sales16" msdata:rowOrder="15">

   <stor_id>7896</stor_id>

   <ord_num>TQ456</ord_num>

   <ord_date>1993-12-12T00:00:00.0000000+02:00</ord_date>

   <qty>10</qty>

   <payterms>Net 60</payterms>

   <title_id>MC2222</title_id>

  </Sales>

  <Sales diffgr:id="Sales17" msdata:rowOrder="16">

   <stor_id>7896</stor_id>

   <ord_num>X999</ord_num>

   <ord_date>1993-02-21T00:00:00.0000000+02:00</ord_date>

   <qty>35</qty>

   <payterms>ON invoice</payterms>

   <title_id>BU2075</title_id>

  </Sales>

  <Sales diffgr:id="Sales18" msdata:rowOrder="17">

   <stor_id>8042</stor_id>

   <ord_num>423LL922</ord_num>

   <ord_date>1994-09-14T00:00:00.0000000+02:00</ord_date>

   <qty>15</qty>

   <payterms>ON invoice</payterms>

   <title_id>MC3021</title_id>

  </Sales>

  <Sales diffgr:id="Sales19" msdata:rowOrder="18">

   <stor_id>8042</stor_id>

   <оrd_num>423LL930</ord_num>

   <ord_date>1994-09-14T00:00:00.0000000+02:00</ord_date>

   <qty>10</qty>

   <payterms>ON invoice</payterms>

   <title_id>BU1032</title_id>

  </Sales>

  <Sales diffgr:id="Sales20" msdata:rowOrder="19">

   <stor_id>8042</stor_id>

   <ord_num>P723</ord_num>

   <ord_date>1993-03-11T00:00:00.0000000+02:00</ord_date>

   <qty>25</qty>

   <payterms>Net 30</payterms>

   <title_id>BU1111</title_id>

  </Sales>

  <Sales diffgr:id="Sales21" msdata:rowOrder="20">

   <stor_id>8042</stor_id>

   <ord_num>QA879.1</ord_num>

   <ord_date>1993-05-22T00:00:00.0000000+02:00</ord_date>

   <qty>30</qty>

   <payterms>Net 30</payterms>

   <title_id>PC1035</title_id>

  </Sales>

  <Stores diffgr:id="Stores1" msdata:rowOrder="0" diffgr:hasChanges="modified">

   <stor_id>999</stor_id>

   <stor_name>Eric the Read Books</stor_name>

   <stor_address>788 Catamaugus Ave.</stor_address>

   <city>Seattle</city>

   <state>WA</state>

   <zip>98056</zip>

  </Stores>

  <Stores diffgr:id="Stores3" msdata:rowOrder="2">

   <stor_id>7067</stor_id>

   <stor_name>News & Brews</stor_name>

   <stor_address>577 First St.</stor_address>

   <city>Los Gatos</city>

   <state>CA</state>

   <zip>96745</zip>

  </Stores>

  <Stores diffgr:id="Stores4" msdata:rowOrder="3">

   <stor_id>7131</stor_id>

   <stor_name>Doc-U-Mat: Quality Laundry and Books</stor_name>

   <stor_address>24-A Avogadro Way</stor_address>

   <city>Remulade</city>

   <state>WA</state>

   <zip>98014</zip>

  </Stores>

  <Stores diffgr:id="Stores5" msdata:rowOrder="4">

   <stor_id>7896</stor_id>

   <stor_name>Fricative Bookshop</stor_name>

   <stor_address>89 Madison St.</stor_address>

   <city>Fremont</city>

   <state>CA</state>

   <zip>90019</zip>

  </Stores>

  <Stores diffgr:id="Stores6" msdata:rowOrder="5">

   <stor_id>8042</stor_id>

   <stor_name>Bookbeat</stor_name>

   <stor_address>679 Carson St.</stor_address>

   <city>Portland</city>

   <state>OR</state>

   <zip>89076</zip>

  </Stores>

  <Stores diffgr:id="Stores7" msdata:rowOrder="6" diffgr:hasChanges="inserted">

   <stor_name>New Store</stor_name>

  </Stores>

 </NewDataSet>

 <diffgr:before>

  <Stores diffgr:id="Stores1" msdata:rowOrder="0">

   <stor_id>6380</stor_id>

   <stor_name>Eric the Read Books</stor_name>

   <stor_address>788 Catamaugus Ave.</stor_address>

   <city>Seattle</city>

   <state>WA</state>

   <zip>98056</zip>

  </Stores>

  <Stores diffgr:id="Stores2" msdata:rowOrder="1">

   <stor_id>7066</stor_id>

   <stor_name>Barnum's</stor_name>

   <stor_address>567 Pasadena Ave.</stor_address>

   <city>Tustin</city>

   <state>CA</state>

   <zip>92789</zip>

  </Stores>

 </diffgr:before>

</diffgr:diffgram>

НА ЗАМЕТКУ

Для сохранения только измененных записей в формате DiffGram следует использовать метод GetChanges:

Dim ChangedDataSet = dsSales.GetChanges()

ChangedDataSet.WriteXml("..\Changes.xml", XmlWriteMode.DiffGram)

В листинге 10.7 приведено содержимое файла DiffGram.xml, полученного в pезультате выполнения этого метода. 

Листинг 10.7. XML-файл changes.xml в формате DiffGram только с измененными записями

<?xml version="1.0" standalone="yes"?>

<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">

 <NewDataSet>

  <Stores diffgr:id="Stores1" msdata:rowOrder="0" diffgr:hasChanges="modified">

   <stor_id>999</stor_fd>

   <stor_name>Eric the Read Books</stor_name>

   <stor_address>788 Catamaugus Ave.</stor_address>

   <city>Seattle</city>

   <state>WA</state>

   <zip>98056</zip>

  </Stores>

  <Stores diffgr:id="Stores3" msdata:rowOrder="2" diffgr:hasChanges="inserted">