Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. synchronizing xml and database

synchronizing xml and database

Scheduled Pinned Locked Moved C#
databasesql-servercryptographyxmlquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LordZoster
    wrote on last edited by
    #1

    Hallo I'm consuming a webservice returning an XML with 5 nested complexType (i.e. 5 relationed tables); I should write those data into corresponding tables in a mssql db, updating or inserting when needed. Do DataAdapters provide such functionality? Actually, the Update method synchronizes a dataset and its original data source. What if the dataset comes from a different datasource? Update uses the RowState property to determine the kind of SQL command to be issued: in my case I should need something like an hash comparison (checksum) between each row in the source dataset and each row in the target db, for each table. I'm considering to transfer to the db the whole process of hashing and comparing. Could you give me your advice? Thanks in advance

    L J 2 Replies Last reply
    0
    • L LordZoster

      Hallo I'm consuming a webservice returning an XML with 5 nested complexType (i.e. 5 relationed tables); I should write those data into corresponding tables in a mssql db, updating or inserting when needed. Do DataAdapters provide such functionality? Actually, the Update method synchronizes a dataset and its original data source. What if the dataset comes from a different datasource? Update uses the RowState property to determine the kind of SQL command to be issued: in my case I should need something like an hash comparison (checksum) between each row in the source dataset and each row in the target db, for each table. I'm considering to transfer to the db the whole process of hashing and comparing. Could you give me your advice? Thanks in advance

      L Offline
      L Offline
      LordZoster
      wrote on last edited by
      #2

      I'm going for the Dataset.Merge(DataSet) method, as in http://msdn.microsoft.com/it-it/library/4swwh51k(v=vs.80).aspx[^] But I would still like to know your opinion, since I hate dealing with recordsets within a code: databases are born to deal with recordsets, and I'm a db guy :)

      1 Reply Last reply
      0
      • L LordZoster

        Hallo I'm consuming a webservice returning an XML with 5 nested complexType (i.e. 5 relationed tables); I should write those data into corresponding tables in a mssql db, updating or inserting when needed. Do DataAdapters provide such functionality? Actually, the Update method synchronizes a dataset and its original data source. What if the dataset comes from a different datasource? Update uses the RowState property to determine the kind of SQL command to be issued: in my case I should need something like an hash comparison (checksum) between each row in the source dataset and each row in the target db, for each table. I'm considering to transfer to the db the whole process of hashing and comparing. Could you give me your advice? Thanks in advance

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        Your question isn't clear. For starters the XML and web services part would seem to have little to do with it. If you have a set of data, regardless of source, which must put into the database as one go then the normal solution is a transaction. If there are multiple target data sources then a distributed transaction MIGHT be a choice however at least some people prefer to use a non-transactional approach in that case.

        L 1 Reply Last reply
        0
        • J jschell

          Your question isn't clear. For starters the XML and web services part would seem to have little to do with it. If you have a set of data, regardless of source, which must put into the database as one go then the normal solution is a transaction. If there are multiple target data sources then a distributed transaction MIGHT be a choice however at least some people prefer to use a non-transactional approach in that case.

          L Offline
          L Offline
          LordZoster
          wrote on last edited by
          #4

          Schematically, I'm dealing with two datasets with the same schema: they have 5 tables. I need to synchronize the two dataset, being Dataset A the source (XML from webservice) and Dataset B the destination (the database).

          J 1 Reply Last reply
          0
          • L LordZoster

            Schematically, I'm dealing with two datasets with the same schema: they have 5 tables. I need to synchronize the two dataset, being Dataset A the source (XML from webservice) and Dataset B the destination (the database).

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            LordZoster wrote:

            I need to synchronize the two dataset, being Dataset A the source (XML from webservice) and Dataset B the destination (the database)

            Yes I understand that you are starting with XML. However that has nothing to do with writing the data in a consistent manner to he database. If you need to read the XML data in a consistent manner than that is still a different problem UNLESS you need to provide some transaction across both sets. If so then, because the first appears to be a file, you are still going to be dealing with a transaction on the database side and for the file side there are mitigations possible but none are ideal.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups