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. About ExecuteNonQuery ?

About ExecuteNonQuery ?

Scheduled Pinned Locked Moved C#
question
6 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.
  • P Offline
    P Offline
    papyrus_lei
    wrote on last edited by
    #1

    when i use procedure CommandType is procedure and then run ExecuteNonQuery() the return value of ExecuteNonQuery() is always -1 so the return value of ExecuteNonQuery is useless when use procedure?

    C A A 3 Replies Last reply
    0
    • P papyrus_lei

      when i use procedure CommandType is procedure and then run ExecuteNonQuery() the return value of ExecuteNonQuery() is always -1 so the return value of ExecuteNonQuery is useless when use procedure?

      C Offline
      C Offline
      cshaaaa
      wrote on last edited by
      #2

      It executes the query and just return the no of rows affected.:laugh:

      P 1 Reply Last reply
      0
      • P papyrus_lei

        when i use procedure CommandType is procedure and then run ExecuteNonQuery() the return value of ExecuteNonQuery() is always -1 so the return value of ExecuteNonQuery is useless when use procedure?

        A Offline
        A Offline
        Anish Gopi
        wrote on last edited by
        #3

        Hai 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. If a rollback occurs, the return value is also -1. For more information See SqlCommand.ExecuteNonQuery Method[^]

        P 1 Reply Last reply
        0
        • P papyrus_lei

          when i use procedure CommandType is procedure and then run ExecuteNonQuery() the return value of ExecuteNonQuery() is always -1 so the return value of ExecuteNonQuery is useless when use procedure?

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          the procedure execute correctly and the data in DB changed. but the return value is -1 why? return value just useful when execute sql query?

          1 Reply Last reply
          0
          • C cshaaaa

            It executes the query and just return the no of rows affected.:laugh:

            P Offline
            P Offline
            papyrus_lei
            wrote on last edited by
            #5

            thanks!

            1 Reply Last reply
            0
            • A Anish Gopi

              Hai 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. If a rollback occurs, the return value is also -1. For more information See SqlCommand.ExecuteNonQuery Method[^]

              P Offline
              P Offline
              papyrus_lei
              wrote on last edited by
              #6

              thanks! ^_^

              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