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. Database & SysAdmin
  3. Database
  4. How to get delete/Update row + SQL

How to get delete/Update row + SQL

Scheduled Pinned Locked Moved Database
databasedebuggingtutorialquestionannouncement
29 Posts 5 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.
  • J jojoba2011

    thanks for ans. But i wanna to get the info from my SQL database . i wanna to have every thing the user changed,Updated,Inserted,Deleted. So i can trace that.

    J Offline
    J Offline
    JohnPayton
    wrote on last edited by
    #19

    Hi jojoba2011, You get the values you need to save from the front end application, what I mean to say is the values you are using in the database insert or update query are also used for the text report audit trail. In the case of the original values that are being replaced, they are stored as a variable when the update/insert page is first populated. Do you understand what I'm saying?

    J 1 Reply Last reply
    0
    • J JohnPayton

      Hi jojoba2011, You get the values you need to save from the front end application, what I mean to say is the values you are using in the database insert or update query are also used for the text report audit trail. In the case of the original values that are being replaced, they are stored as a variable when the update/insert page is first populated. Do you understand what I'm saying?

      J Offline
      J Offline
      jojoba2011
      wrote on last edited by
      #20

      first of all thanks for your attention! Sorry i cant understand! I think that u add values to txt when inserting them to Database. Correct? But i wanna to get it from DB.even if the text file deleted i can get info back.

      J 1 Reply Last reply
      0
      • J jojoba2011

        thanks for you reply for both C# and Database pages. But isnt it possible to have when running update SP. Its very important to do that . if possible then its end of story. Q2)is it possible to have the OLD trace if the user delete the .trc file from SQL.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #21

        jojoba2011 wrote:

        But isnt it possible to have when running update SP.
         
        Its very important to do that .
        if possible then its end of story.

        No, not possible.

        jojoba2011 wrote:

        is it possible to have the OLD trace if the user delete the .trc file from SQL.

        Yes, as I already suggested when I answered the post; embed a trace-file as an embedded resource. That way it will be compiled "into" your executable. ..but no, unless you're the administrator and have more rights on my machine than I do, I'll not only change the trace-file, I'll even make sure that there's fake data entered for your amusement.

        Bastard Programmer from Hell :suss:

        J 1 Reply Last reply
        0
        • L Lost User

          jojoba2011 wrote:

          But isnt it possible to have when running update SP.
           
          Its very important to do that .
          if possible then its end of story.

          No, not possible.

          jojoba2011 wrote:

          is it possible to have the OLD trace if the user delete the .trc file from SQL.

          Yes, as I already suggested when I answered the post; embed a trace-file as an embedded resource. That way it will be compiled "into" your executable. ..but no, unless you're the administrator and have more rights on my machine than I do, I'll not only change the trace-file, I'll even make sure that there's fake data entered for your amusement.

          Bastard Programmer from Hell :suss:

          J Offline
          J Offline
          jojoba2011
          wrote on last edited by
          #22

          thanks, your really active one. can you give me an example that how can i embed a trace-file as an embedded resource in C# in my app.???

          L 1 Reply Last reply
          0
          • J jojoba2011

            thanks, your really active one. can you give me an example that how can i embed a trace-file as an embedded resource in C# in my app.???

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #23

            I could, but it's your work. There are enough examples on the internet, and they don't take more than a few lines of code. Good luck :)

            Bastard Programmer from Hell :suss:

            J 1 Reply Last reply
            0
            • J jojoba2011

              first of all thanks for your attention! Sorry i cant understand! I think that u add values to txt when inserting them to Database. Correct? But i wanna to get it from DB.even if the text file deleted i can get info back.

              J Offline
              J Offline
              JohnPayton
              wrote on last edited by
              #24

              Yes that's right, you keep the values you are inserting/updating/deleting then call a routine to record the changes in the ascii text audit file. :) Re Getting data from the DB, I'm sorry but I don't know how to retrieve data from SQLServer from past transactions, I'm sure it's possible from the transaction log. But in my circumstances it's been easier to just store the old values and new values when they happen to variables then send to the ascii log file.

              J 1 Reply Last reply
              0
              • J JohnPayton

                Yes that's right, you keep the values you are inserting/updating/deleting then call a routine to record the changes in the ascii text audit file. :) Re Getting data from the DB, I'm sorry but I don't know how to retrieve data from SQLServer from past transactions, I'm sure it's possible from the transaction log. But in my circumstances it's been easier to just store the old values and new values when they happen to variables then send to the ascii log file.

                J Offline
                J Offline
                jojoba2011
                wrote on last edited by
                #25

                thanks! but i wanna to have that .how to retrieve data from SQLServer from past transactions

                1 Reply Last reply
                0
                • L Lost User

                  I could, but it's your work. There are enough examples on the internet, and they don't take more than a few lines of code. Good luck :)

                  Bastard Programmer from Hell :suss:

                  J Offline
                  J Offline
                  jojoba2011
                  wrote on last edited by
                  #26

                  Hi,Thanks i wanna to have something like "ApexSQL Log" but not that much big.

                  L 1 Reply Last reply
                  0
                  • J jojoba2011

                    Hi,Thanks i wanna to have something like "ApexSQL Log" but not that much big.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #27

                    I don't know the product, but I'm guessing it's a tool that saves both the old and the new values. You already have a table - you can easily insert new values without ever touching the old ones. It won't be "as big" as any external audit, since any external data-file would have more overhead. If your client needs to keep all historic values, then you simply don't update or delete.

                    Bastard Programmer from Hell :suss:

                    J 1 Reply Last reply
                    0
                    • L Lost User

                      I don't know the product, but I'm guessing it's a tool that saves both the old and the new values. You already have a table - you can easily insert new values without ever touching the old ones. It won't be "as big" as any external audit, since any external data-file would have more overhead. If your client needs to keep all historic values, then you simply don't update or delete.

                      Bastard Programmer from Hell :suss:

                      J Offline
                      J Offline
                      jojoba2011
                      wrote on last edited by
                      #28

                      hi dear. this is exact the tool that i wanna.this read .ldf(log) file of SQL and convert it to human Language.it exactly show the old values and new values both .i wanna to do this my self without buying it and i dont wanna that much info. See can u give me something like that > I know that u can do that cause ur expert in SQL.

                      L 1 Reply Last reply
                      0
                      • J jojoba2011

                        hi dear. this is exact the tool that i wanna.this read .ldf(log) file of SQL and convert it to human Language.it exactly show the old values and new values both .i wanna to do this my self without buying it and i dont wanna that much info. See can u give me something like that > I know that u can do that cause ur expert in SQL.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #29

                        jojoba2011 wrote:

                        hi dear

                        I'd like to suggest a more neutral greeting.

                        jojoba2011 wrote:

                        See can u give me something like that

                        No, because the structure of the ldf-file isn't public. You'd still need to talk to Microsoft if you want to read the ldf-file. Or try and lull the company into handing you some help.

                        jojoba2011 wrote:

                        I know that u can do that cause ur expert in SQL.

                        Nope; I can only give some options -

                        • You can do a real audit in Sql Server, not Sql Express
                        • You can trace, but that doesn't show the "old" values
                        • You can insert without update. Sounds wrong, but is often the best solution, since your table is the most optimized structure to hold that type of data.
                        • You could create triggers to copy both old and new values to some other table, which would be the complex version of the point above, without too much added value.
                        • You can change the datalayer of the code talking to your server, and have it log there.
                        • Talk to Microsoft

                        Bastard Programmer from Hell :suss:

                        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