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 / C++ / MFC
  4. primary key

primary key

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasetutorialquestion
5 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.
  • T Offline
    T Offline
    Try
    wrote on last edited by
    #1

    How to determine which field in a database table is the primary key (in OLEDB or ODBC) using MFC (VC++ 2005)? Thanks in advance..

    N D M 3 Replies Last reply
    0
    • T Try

      How to determine which field in a database table is the primary key (in OLEDB or ODBC) using MFC (VC++ 2005)? Thanks in advance..

      N Offline
      N Offline
      Nitheesh George
      wrote on last edited by
      #2

      Hi, I don't think this can be done using MFC. You can find it from sys tables of the database. thanks Nitheesh

      1 Reply Last reply
      0
      • T Try

        How to determine which field in a database table is the primary key (in OLEDB or ODBC) using MFC (VC++ 2005)? Thanks in advance..

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

        I do not think anything has changed since you last asked this question. Just out of curiosity, why do you need to know such information (i.e, what part of your code is relying upon it)?

        "Love people and use things, not love things and use people." - Unknown

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        T 1 Reply Last reply
        0
        • T Try

          How to determine which field in a database table is the primary key (in OLEDB or ODBC) using MFC (VC++ 2005)? Thanks in advance..

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          With ODBC, there's SQLPrimaryKeys()[^] Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • D David Crow

            I do not think anything has changed since you last asked this question. Just out of curiosity, why do you need to know such information (i.e, what part of your code is relying upon it)?

            "Love people and use things, not love things and use people." - Unknown

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            T Offline
            T Offline
            Try
            wrote on last edited by
            #5

            I will update a field (Say fieldName)in the application. A trigger is executed outside the application in oracle, which changes the value of another field (Say fieldNumber=1, Now changed to fieldNumber=2 after trigger). The method i follow after field update is : 1. Update (fieldName) to database 2. Refresh the updated value and trigger changed value (fieldNumber=2) to text box. I am doing refresh using select statement .. where ... (select * from tbl where fieldNumber=1) Since the trigger changes value outside application, my select statement's where clause have old value (fieldNumber=1). It fails. Hence i want to know the primary key of the table and use refresh using select statement (only primary key)..

            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