butterhook
asked on
Simple database connection C++ ODBS DSN datasource
Hi, I would like to connect to a System ODBC data source (DSN) from my C++ application. I am not using MFC. I believe this should be easy but cannot find anything simple anywhere!
I want to run the query 'INSERT INTO TestTable (Field1) VALUES ('Hello World')"
In pseudocode I believe it would be like this
create new database object
open database object from the database 'mydatabase'
run insert query
close database connection
destroy database object
Can anyone help?
I want to run the query 'INSERT INTO TestTable (Field1) VALUES ('Hello World')"
In pseudocode I believe it would be like this
create new database object
open database object from the database 'mydatabase'
run insert query
close database connection
destroy database object
Can anyone help?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
MFC has a CDatabase class to hide all of the complexities of the lower-level SQLXxxxx functions. The functions are very reliable and since all target computers come with the MFC DLL, there is no particular code bloat or other problems. Do you have a particular reason to avoide the MFC objects?
ASKER
There obviously seem to be a lot of ways to do this - I actually used a different method to the both above but I gave you the points as a gesture of goodwill.
>>>> I actually used a different method to the both above
>>>> but I gave you the points as a gesture of goodwill.
Thanks ;-)
Can you tell what method you used? You asked for an ODBC access in C++ not using MFC. I know there are some third party libraries and of course you might use COM and ADO. But none of them has any (experienced) advantage over MFC and I would like to agree to Dan regarding the stability and reliabilty of the MFC ODBC implementation.
Regards, Alex
>>>> but I gave you the points as a gesture of goodwill.
Thanks ;-)
Can you tell what method you used? You asked for an ODBC access in C++ not using MFC. I know there are some third party libraries and of course you might use COM and ADO. But none of them has any (experienced) advantage over MFC and I would like to agree to Dan regarding the stability and reliabilty of the MFC ODBC implementation.
Regards, Alex
ASKER