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