Results 1 to 5 of 5

Thread: Edit xml for batch update

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Three Anchor Bay, Cape Town, South Africa
    Posts
    769

    Edit xml for batch update

    Hi,

    I have data (selected from a database) which must be presented to a user for editing. This data is fairly complex and there are many records (50+ records a time) which must be edited. We have decided to use an xml datasource bound to the html controls to edit the data. The xml document is then sent back to the server to update the database.

    However, this is more tricky than it sounds. We are using the ado schema. But, the schema for an unchanged record is
    Code:
    <z:row />
    , the shema for a changed row is

    Code:
    <rs:update>
      <rs:original>
        <z:row />
      </rs:original>
      
      <z:row />
    </rs:update>
    If I bind my controls to the document, the controls change the value of the attributes only, and not the document schema. This means that the structure that I am sending back to the server is one of an unupdated recordset, even though the data has changed. When loaded back into the recordset object, the recordset see's the data as though some other user has changed the data in the database while this xml doc was being persisted, when in actual fact, it is the oposite and the document should update the database.

    The solution, I thought, was to use two xslt's. One to output to the client, creating a copy of each row that will act as a reference and another copy which will be used for the binding and updating of the controls. Then the second xslt would then compare the two versions of the data when submitted back to the server, and format these into the ado form. The result will then be inputed into a recordset object and update the database.

    Does anyone have a neater way of doing the same thing?

  2. #2
    Lively Member
    Join Date
    Jul 2001
    Location
    USA
    Posts
    95
    Are you looking to do something like this?

    http://www.xmlpitstop.com/demos/User...wCustomers.htm

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Three Anchor Bay, Cape Town, South Africa
    Posts
    769
    almost. How is the update achieved? is it sending the xml back, or is loading the xml data into the controls and then using an html form to submit data?

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Three Anchor Bay, Cape Town, South Africa
    Posts
    769
    Also, this does not check whether or not another has changed the data since I downloaded it. Thus any changes that I make will override the other users changes without warning me of this.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Three Anchor Bay, Cape Town, South Africa
    Posts
    769
    Ok. I see... I just looked at the source. Its using the xml http.

    This is basically what I have done. See, the problem comes in when you need to update the database. You need a reference with which to check if another user has changed the database data while you were making your changes to the persisted data.

    The ado recordset object handles this for us. But now, using xml, we have to start thinking about these types of issues. In the ado schema, they actualy maintain the original row and then have an additional row that contains the updated value. The more I look at it, the more I think that this is the only way. I am looking of other methods such as persisting an xml file on the hard drive, but this encounters versioning problems. My other solution is to store the original in the database in a separate table. But again, this introduces some versioning problems.

    Any other ideas?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width