I need to write a simple C++ program that:
1) creates a table in an existing database
2) inserts a record in the table and
3) reads a record from the table
Can someone provide me with a simple code (or suggest to me an online tutorial) for doing the above tasks using ADO (ActiveX Data Object)?
I searched on the internet but I couldn't find a simple sample code addressing the above issues.
My C++ program needs to access an SQL Server 2005 Database.
Many thanks in advance.
Last edited by nikolasapl; January 30th, 2011 at 01:32 AM.
The Google search for ado vc++ example displays the first item to be ADO Code Examples in Visual C++. Now you can open any of the links to see how to begin working with ADO.
To connect to the SQL Server 2005 Database - use one of the related connection strings.
To create a table - use CREATE TABLE ... T_SQL clause, to insert a record - INSERT INTO ..., to read a record(s) - SELECT ... FROM ....
Thanks for your replies, but I do not even know the very basics of ADO programming in C++, so they did not help me...
Well, I didn't know anything about ADO about 10 years ago either!
But reading MSDN documentation + testing some of MSDN examples + searching in the Web about ADO helped me to understand it a little and then use it in my Apps.
Bookmarks