Data Shaping - Persist to and load from XML ... 
Author Message
 Data Shaping - Persist to and load from XML ...

I have this simple shape that I persist in the ADO XML format. Now I try to
reload this data after having made a few minor changes in the content of the
document. Yet, the changes do not show up in the database...

Below you find the code that I used in my test. What am I doing wrong ?

----------------------------------------------------------------------------
-------------------------------

var adOpenDynamic = 2;
var adOpenStatic = 3;

var adLockOptimistic = 3;
var adLockBatchOptimistic = 4

var adCmdText = 1;
var adCmdFile = 256;

var adPersistXML = 1;

try
{
    var cn = new ActiveXObject("ADODB.Connection");
    var rsOut = new ActiveXObject("ADODB.RecordSet");
    var rsIn = new ActiveXObject("ADODB.RecordSet");

    WScript.Echo("Connecting to database...");
    cn.Open("Provider=MSDataShape; Data Provider=MSDAORA; Data Source=ECOM",
"storefront", "oracle");

    var sql = "SHAPE";
    sql += "{";
    sql += "    SELECT * FROM ORDERS WHERE (ORDERID = 188)";
    sql += "}";
    sql += "APPEND";
    sql += "(";
    sql += "    {";
    sql += "        SELECT * FROM CUSTOMERS";
    sql += "    }";
    sql += "    RELATE CUSTOMERID TO CUSTOMERID";
    sql += ") AS Customer,";
    sql += "(";
    sql += "    {";
    sql += "        SELECT * FROM ORDERDETAILS";
    sql += "    }";
    sql += "    RELATE ORDERID TO ORDERID";
    sql += ") AS OrderLine";

    WScript.Echo("Collecting data...");
    rsOut.Open(sql, cn, adOpenDynamic, adLockOptimistic, adCmdText);
    WScript.Echo("Persisting data...");
    rsOut.Save(".\\Data\\Persistence.dat", adPersistXML);

    WScript.Echo("Loading data...");
    rsIn.LockType = adLockBatchOptimistic;
    rsIn.Open(".\\Data\\Persistence.new.dat");
    WScript.Echo("Connecting database...");
    rsIn.ActiveConnection = cn;
    WScript.Echo("Updating...");
    cn.BeginTrans();
    rsIn.UpdateBatch();
    cn.CommitTrans();

Quote:
}

catch(e)
{
    WScript.Echo((e.number & 0xFFFF) + " - " + e.description);
    cn.RollbackTrans();

Quote:
}

----------------------------------------------------------------------------
-------------------------------


Sat, 23 Nov 2002 03:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Loading Xml Data returned from the query loaded into recordset

2. How to divide data and schema description in persisted recordset (XML)

3. xml data produced by FOR XML AUTO cannot be loaded with MSXML API

4. Persist recordset as XML, or cook XML w/ XMLDSO

5. Urgent: Shaping Persisted Recordset - Repost

6. Big Problems With Persisted Recordset and Shaping - Urgent !

7. Recordset persisting using shape + adPersistADTG (long)

8. ado data shaping (xml)

9. Big Problems With Persisted Recordset and Shaping - Urgent !

10. Urgent: Shaping Persisted Recordset - Repost

11. Persisting Parameterized Shaped Recordsets

12. Problem Saving ADO data shapes recordsets as XML


 
Powered by phpBB® Forum Software