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. General Programming
  3. C / C++ / MFC
  4. Need help of how to execute SQL update query in VC++

Need help of how to execute SQL update query in VC++

Scheduled Pinned Locked Moved C / C++ / MFC
databasec++helptutorialquestion
4 Posts 4 Posters 1 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 I know that the below query will help me to get the records count.. update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated But i want to execute this query through my VC++ code.. Cany one help me out how to execute this query and how to retrieve no of records updated count as return value..? Can any one help me out as it urgent requirement for me.. Thanks John.

    C A D 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 I know that the below query will help me to get the records count.. update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated But i want to execute this query through my VC++ code.. Cany one help me out how to execute this query and how to retrieve no of records updated count as return value..? Can any one help me out as it urgent requirement for me.. Thanks John.

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      I think you should start here[^].

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Sometimes you just have to hate coding to do it well. <

      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 I know that the below query will help me to get the records count.. update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated But i want to execute this query through my VC++ code.. Cany one help me out how to execute this query and how to retrieve no of records updated count as return value..? Can any one help me out as it urgent requirement for me.. Thanks John.

        A Offline
        A Offline
        Anil Kumar Arvapalli
        wrote on last edited by
        #3

        Try Like this char *name="ravi"; int index=1; CString str=_T("update employee set emp_name ="); str.format("'%s' where emp_id=%d",name,index); and pass str as argument to ur Execute query... Hope it is ur answer wat ur looking for it. Can u please tell me what are the settings that we need in project to connect to database from VC++. please share it so that it wil be help full for me please

        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 I know that the below query will help me to get the records count.. update employee set emp_name = 'Ravi' where emp_id = 1; Select @@Rowcount Updated But i want to execute this query through my VC++ code.. Cany one help me out how to execute this query and how to retrieve no of records updated count as return value..? Can any one help me out as it urgent requirement for me.. Thanks John.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          John502 wrote:

          Cany one help me out how to execute this query...

          Have you tried SQLExecute()?

          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          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