Deleting a record by using a DiffGram
The DiffGram in this example deletes a customer (whose CustomerID is ALFKI) record from the Cust table and deletes the corresponding order record (whose OrderID is 1) from the Ord table.
Code:
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql" sql:mapping-schema="DiffGramSchema.xml">
<diffgr:diffgram
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<DataInstance/>
<diffgr:before>
<Order diffgr:id="Order1"
msdata:rowOrder="0"
CustomerID="ALFKI"
OrderID="1"/>
<Customer diffgr:id="Customer1"
msdata:rowOrder="0"
CustomerID="ALFKI">
<CompanyName>Alfreds Futterkiste</CompanyName>
<ContactName>Maria Anders</ContactName>
</Customer>
</diffgr:before>
<msdata:errors/>
</diffgr:diffgram>
</ROOT> In the
<before> block, there is an
<Order> element (
diffgr:id="Order1") and a <
Customer> element (
diffgr:id="Customer1"). These elements represent existing records in the database. The <
DataInstance> element does not have the corresponding records (with the same
diffgr:id). This indicates a delete operation.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!