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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Need help on how to update SQL query using VC++

Need help on how to update SQL query using VC++

Scheduled Pinned Locked Moved Database
databasec++helptutorialannouncement
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.
  • J Offline
    J Offline
    John502
    wrote on last edited by
    #1

    Hi, I have one SQL query, i want to update it in one database. Please check that SQL query below. update employee set emp_name = 'Ravi' where emp_id = 1 Now i want to get the count of how many rows get updated.. Can any one help me out as it urgent requirement for me.. Thanks John.

    D N M 3 Replies Last reply
    0
    • J John502

      Hi, I have one SQL query, i want to update it in one database. Please check that SQL query below. update employee set emp_name = 'Ravi' where emp_id = 1 Now i want to get the count of how many rows get updated.. Can any one help me out as it urgent requirement for me.. Thanks John.

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      ExecuteNonQuery would do that if you are speaking of managed C++.

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      1 Reply Last reply
      0
      • J John502

        Hi, I have one SQL query, i want to update it in one database. Please check that SQL query below. update employee set emp_name = 'Ravi' where emp_id = 1 Now i want to get the count of how many rows get updated.. Can any one help me out as it urgent requirement for me.. Thanks John.

        N Offline
        N Offline
        Niladri_Biswas
        wrote on last edited by
        #3

        Try with OUTPUT command introduced with SQL SERVER 2005. This link may help you http://www.aspfree.com/c/a/MS-SQL-Server/Wonders-of-the-OUTPUT-Clause-in-SQL-Server-2005/[^] http://www.databasejournal.com/features/mssql/article.php/3598636/OUTPUT-clause-in-SQL-Server-2005.htm[^] :)

        Niladri Biswas

        1 Reply Last reply
        0
        • J John502

          Hi, I have one SQL query, i want to update it in one database. Please check that SQL query below. update employee set emp_name = 'Ravi' where emp_id = 1 Now i want to get the count of how many rows get updated.. Can any one help me out as it urgent requirement for me.. Thanks John.

          M Offline
          M Offline
          Mycroft Holmes
          wrote on last edited by
          #4

          I always use stored procs but this may work.

          update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated

          Not sure if it requires a colon or a semi colon.

          J 1 Reply Last reply
          0
          • M Mycroft Holmes

            I always use stored procs but this may work.

            update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated

            Not sure if it requires a colon or a semi colon.

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

            Hello Holmes, Yes, you have given exact query.. i have executed this query in QueryAnalyser it is working fine and this what i am expecting.. Can you please explain me how to execute this query through VC++..? Thanks John.

            M 1 Reply Last reply
            0
            • J John502

              Hello Holmes, Yes, you have given exact query.. i have executed this query in QueryAnalyser it is working fine and this what i am expecting.. Can you please explain me how to execute this query through VC++..? Thanks John.

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              Sorry, I wouldn't know VC++ if it wandered up and bit me, I suggest you take it to the language forum.

              Never underestimate the power of human stupidity RAH

              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