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. mark rows as deleted or updated befor loading them in a dataset

mark rows as deleted or updated befor loading them in a dataset

Scheduled Pinned Locked Moved C#
databasesysadminxmlquestionannouncement
8 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.
  • H Offline
    H Offline
    hadad
    wrote on last edited by
    #1

    Hello, I'm developping a sync solution enables filtering but is there any way to load the changes form the source database into a dataset and mark the deleted or updated rows to transfer this dataset to client and update its data? I've tryied to use the Microsoft Sync Framework but it does not allow filtering even if I use a custom provider because in my scenariro I want to sync a subset of the data on the server with a client and vice versa sync framework depends on primary key only which not acceptable here because when deleting or updating rows these rows may deletetd for another user in the source database the primary key in the client will not be the same as the server this is because I want to select the changes as xml and populate the dataset soit can mark the deleted rows and updated .. ctc

    Dad

    N 1 Reply Last reply
    0
    • H hadad

      Hello, I'm developping a sync solution enables filtering but is there any way to load the changes form the source database into a dataset and mark the deleted or updated rows to transfer this dataset to client and update its data? I've tryied to use the Microsoft Sync Framework but it does not allow filtering even if I use a custom provider because in my scenariro I want to sync a subset of the data on the server with a client and vice versa sync framework depends on primary key only which not acceptable here because when deleting or updating rows these rows may deletetd for another user in the source database the primary key in the client will not be the same as the server this is because I want to select the changes as xml and populate the dataset soit can mark the deleted rows and updated .. ctc

      Dad

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Normally in this situation there is a timestamp field, or some other type, in the database that is used to tell if a row has been updated. Add a where clause to your query to get the changed rows.


      I know the language. I've read a book. - _Madmatt

      H 1 Reply Last reply
      0
      • N Not Active

        Normally in this situation there is a timestamp field, or some other type, in the database that is used to tell if a row has been updated. Add a where clause to your query to get the changed rows.


        I know the language. I've read a book. - _Madmatt

        H Offline
        H Offline
        hadad
        wrote on last edited by
        #3

        Yes I've done it but I want to transfer the data to the client as a dataset holding the changes so how I tell the dataset that certain row is deleted or inserted or updated when it reads the xml file and not aftr loading the data throw the rowstate property

        Dad

        N 1 Reply Last reply
        0
        • H hadad

          Yes I've done it but I want to transfer the data to the client as a dataset holding the changes so how I tell the dataset that certain row is deleted or inserted or updated when it reads the xml file and not aftr loading the data throw the rowstate property

          Dad

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          I don't understand what you are asking. You have all the tools, what is the problem you are having?


          I know the language. I've read a book. - _Madmatt

          H 1 Reply Last reply
          0
          • N Not Active

            I don't understand what you are asking. You have all the tools, what is the problem you are having?


            I know the language. I've read a book. - _Madmatt

            H Offline
            H Offline
            hadad
            wrote on last edited by
            #5

            I select the modified data from the sql server as a xml I've added an attribute to each row to tell me its state when I load this file to a dataset it does not read the stated it marks all rows as Added by default so if I want to change the state I have to loop over the table and change the rowstate property my question is Can I change the state when the data set loads the xml file or I have to loop over the table after population?

            Dad

            N 1 Reply Last reply
            0
            • H hadad

              I select the modified data from the sql server as a xml I've added an attribute to each row to tell me its state when I load this file to a dataset it does not read the stated it marks all rows as Added by default so if I want to change the state I have to loop over the table and change the rowstate property my question is Can I change the state when the data set loads the xml file or I have to loop over the table after population?

              Dad

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Why are you returning XML that is then placed into a dataset? :omg: This makes no sense at all. Its like converting an int to a string then back to an int. Add the column to the select query then it will be in the dataset already. Otherwise, no, there is no other way except to iterate through the rows.


              I know the language. I've read a book. - _Madmatt

              H 1 Reply Last reply
              0
              • N Not Active

                Why are you returning XML that is then placed into a dataset? :omg: This makes no sense at all. Its like converting an int to a string then back to an int. Add the column to the select query then it will be in the dataset already. Otherwise, no, there is no other way except to iterate through the rows.


                I know the language. I've read a book. - _Madmatt

                H Offline
                H Offline
                hadad
                wrote on last edited by
                #7

                I've tried the xml to let me choose an intermediate method to tell the dataset the state of rows but it will be more efficient if it loads the data directly but If it does, also, How can I tell the row state? this data set will be transferred to a client where another adapter will update the client database so the dataset must tell the state of the rows which I cant do when loading the data because the column which tell the state is invented by my sql script and it does not belong to table so the data set will trait it as a normal column.

                Dad

                N 1 Reply Last reply
                0
                • H hadad

                  I've tried the xml to let me choose an intermediate method to tell the dataset the state of rows but it will be more efficient if it loads the data directly but If it does, also, How can I tell the row state? this data set will be transferred to a client where another adapter will update the client database so the dataset must tell the state of the rows which I cant do when loading the data because the column which tell the state is invented by my sql script and it does not belong to table so the data set will trait it as a normal column.

                  Dad

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #8

                  You are making this out to be much more difficult that it really is. This issue in particular and the entire architecture of your application from the sounds of it. If the client can call the database to update the records why are you placing this intermediary step in between, access from the client, or better yet from a properly constructed dta accsss layer.

                  hadad wrote:

                  invented by my sql script and it does not belong to table

                  YES it does. If it's in the select statement is will be in the dataset. RTFM!!


                  I know the language. I've read a book. - _Madmatt

                  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