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. SQL woes

SQL woes

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpjsontutorialquestion
4 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.
  • H Offline
    H Offline
    halblonious
    wrote on last edited by
    #1

    Thanks to those who answered my last message. Now, I've found a way to actually LOOK at the database, and I can connect to the DSN. The only problem is: How do I connect to the actual database that I want. I mean, there's like 6 databases in that DSN, and only one of them is the one I want, the rest are master, model, msdb, etc.... How to I access the one I want. I tried doing an INSERT INTO statement to the table I wanted, but it failed (I can only assume it's because I don't yet know how to specify which database it is). Thanks for any help you can give me. halblonious

    B D G 3 Replies Last reply
    0
    • H halblonious

      Thanks to those who answered my last message. Now, I've found a way to actually LOOK at the database, and I can connect to the DSN. The only problem is: How do I connect to the actual database that I want. I mean, there's like 6 databases in that DSN, and only one of them is the one I want, the rest are master, model, msdb, etc.... How to I access the one I want. I tried doing an INSERT INTO statement to the table I wanted, but it failed (I can only assume it's because I don't yet know how to specify which database it is). Thanks for any help you can give me. halblonious

      B Offline
      B Offline
      basementman
      wrote on last edited by
      #2

      You have many options: 1)Specify the database in the ODBC DSN 2)Specify the full qualifier in your statements (select * from MyDB..MyTable, insert into MyDB..MyTable...) 3)Do a SQLExecDirect of "use MyDB"  onwards and upwards...

      1 Reply Last reply
      0
      • H halblonious

        Thanks to those who answered my last message. Now, I've found a way to actually LOOK at the database, and I can connect to the DSN. The only problem is: How do I connect to the actual database that I want. I mean, there's like 6 databases in that DSN, and only one of them is the one I want, the rest are master, model, msdb, etc.... How to I access the one I want. I tried doing an INSERT INTO statement to the table I wanted, but it failed (I can only assume it's because I don't yet know how to specify which database it is). Thanks for any help you can give me. halblonious

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

        halblonious wrote: I mean, there's like 6 databases in that DSN... A DSN is tied to only one database at a time. When you created the DSN through the ODBC applet in Control Panel, you were asked to pick the database. I've used DSNs with both Access and SQL databases, and aside from how the actual DSN dialog box looks and behaves, it's a 1:1 relationship. I may be way off base here. If so, please provide a small code snippet to help clarify the issue(s).


        A rich person is not the one who has the most, but the one that needs the least.

        1 Reply Last reply
        0
        • H halblonious

          Thanks to those who answered my last message. Now, I've found a way to actually LOOK at the database, and I can connect to the DSN. The only problem is: How do I connect to the actual database that I want. I mean, there's like 6 databases in that DSN, and only one of them is the one I want, the rest are master, model, msdb, etc.... How to I access the one I want. I tried doing an INSERT INTO statement to the table I wanted, but it failed (I can only assume it's because I don't yet know how to specify which database it is). Thanks for any help you can give me. halblonious

          G Offline
          G Offline
          Ger Hayden
          wrote on last edited by
          #4

          Using the CDatabase class to read an Access databases By Zahirul Haque also on this site shows how to cinnect to the actual MDB file if you are using ACCESS Ger

          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