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. Web Development
  3. ASP.NET
  4. How Is Possible Check Row Affected

How Is Possible Check Row Affected

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestionannouncement
12 Posts 4 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.
  • M marconi Flangepants

    Hows it is possible to tell when rows in SQL database have been updated by the update command? My page does need to know if the row is now renewed with the data, and how many rows was updated. Your help is needs must.

    I Offline
    I Offline
    indianet
    wrote on last edited by
    #2

    http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.rowupdated.aspx[^]

    M 1 Reply Last reply
    0
    • M marconi Flangepants

      Hows it is possible to tell when rows in SQL database have been updated by the update command? My page does need to know if the row is now renewed with the data, and how many rows was updated. Your help is needs must.

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

      If you are using 2.0 look at SqlDependency or SqlCacheDependency


      only two letters away from being an asset

      M 1 Reply Last reply
      0
      • I indianet

        http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.rowupdated.aspx[^]

        M Offline
        M Offline
        marconi Flangepants
        wrote on last edited by
        #4

        I read this but it does not make clear to me.

        1 Reply Last reply
        0
        • N Not Active

          If you are using 2.0 look at SqlDependency or SqlCacheDependency


          only two letters away from being an asset

          M Offline
          M Offline
          marconi Flangepants
          wrote on last edited by
          #5

          Perhaps i not make myself clear. I code the SqlConnection with Update command manually and update the record. Inot use any DataSet or others. When i run Update it update the informations. This is good. But how do i see how many rows records have been updated? Please your help for i read the dependencies infos but not mean anything to me. This is not right for my problem i think. Thank

          N 1 Reply Last reply
          0
          • M marconi Flangepants

            Perhaps i not make myself clear. I code the SqlConnection with Update command manually and update the record. Inot use any DataSet or others. When i run Update it update the informations. This is good. But how do i see how many rows records have been updated? Please your help for i read the dependencies infos but not mean anything to me. This is not right for my problem i think. Thank

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

            ExecuteNonQuery "For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1."


            only two letters away from being an asset

            M 1 Reply Last reply
            0
            • N Not Active

              ExecuteNonQuery "For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1."


              only two letters away from being an asset

              M Offline
              M Offline
              marconi Flangepants
              wrote on last edited by
              #7

              Many Thank For Answer. My question is how do i find this information to make us of please? I know not how i get this return value from Insert statement.

              N 1 Reply Last reply
              0
              • M marconi Flangepants

                Many Thank For Answer. My question is how do i find this information to make us of please? I know not how i get this return value from Insert statement.

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

                marconi Flangepants wrote:

                how do i find this information

                Microsoft is very clever, they keep this stuff hidden very securely on a public site called MSDN[^]. Perhaps you've heard it mentioned a few million times in these forums.


                only two letters away from being an asset

                M 1 Reply Last reply
                0
                • N Not Active

                  marconi Flangepants wrote:

                  how do i find this information

                  Microsoft is very clever, they keep this stuff hidden very securely on a public site called MSDN[^]. Perhaps you've heard it mentioned a few million times in these forums.


                  only two letters away from being an asset

                  M Offline
                  M Offline
                  marconi Flangepants
                  wrote on last edited by
                  #9

                  Is my question make angry? Sorry that my brain does not knows these things yet.

                  1 Reply Last reply
                  0
                  • M marconi Flangepants

                    Hows it is possible to tell when rows in SQL database have been updated by the update command? My page does need to know if the row is now renewed with the data, and how many rows was updated. Your help is needs must.

                    L Offline
                    L Offline
                    l0kke
                    wrote on last edited by
                    #10

                    I don't see a problem... I suppose you use SqlCommand to run your UPDATE statement, right? And SqlCommand.ExecuteNonQuery method returns you number of affected rows... Or do I not understand what you mean? Pilo

                    M 1 Reply Last reply
                    0
                    • L l0kke

                      I don't see a problem... I suppose you use SqlCommand to run your UPDATE statement, right? And SqlCommand.ExecuteNonQuery method returns you number of affected rows... Or do I not understand what you mean? Pilo

                      M Offline
                      M Offline
                      marconi Flangepants
                      wrote on last edited by
                      #11

                      Yes, I do like this SqlConnection6.ConnectionString = "connstring goes here"; string sql = "update string goes here"; SqlCommand cmd = new SqlCommand(sql, SqlConnection6); SqlConnection6.Open(); cmd.ExecuteNonQuery(); SqlConnection6.Close(); So how from this must i get number of rows please?

                      L 1 Reply Last reply
                      0
                      • M marconi Flangepants

                        Yes, I do like this SqlConnection6.ConnectionString = "connstring goes here"; string sql = "update string goes here"; SqlCommand cmd = new SqlCommand(sql, SqlConnection6); SqlConnection6.Open(); cmd.ExecuteNonQuery(); SqlConnection6.Close(); So how from this must i get number of rows please?

                        L Offline
                        L Offline
                        l0kke
                        wrote on last edited by
                        #12

                        int rowsAffected = cmd.ExecuteNonQuery(); we call it return value :) Pilo

                        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