Would someone do a huge favor for a 15 year old aspiring programmer? (yes, that was a interest grabber)
I'm building a system for my school to make administration easier on the staff there and I need to get a C++ command line program to run ODBC and connect to an MySQL database, retrieve data and and submit data (updates alters and inserts).

I have the ODBC driver for MySQL implemented and I have it connecting to my SQL host but only using the test function of the ODBC admin.

What I need is an example program, something with a lot of comments and explanations in it, that can access a MySQL database (connect) run SQL insert and select commands (returning to strings) and be just in a simple interface. (preferably in Visual (studio or C) format and in one big file)

I have spent upwards of 20 (unsuccessful) hours trying to get it to work by myself before coming for help so I'm sure others are having the same issues. I hope that you will take the time to solve this. I've probably tried to follow the tutorials and wrappers that you can point me to. I'm probably just dumb for not understanding, but I want to understand and learn how to do this myself (eventually).

I thought I had a baseline knowledge of programming in c++ until I had to take this on.

Thank you so, so much.


Windows XP SP2
Visual Studio 2005
ODBC with host on local network EX: (
newest Visual C express as of 2008

Oh, and if you need more info, please let me know!

The MySQL web site has a set of C++ classes that you can use. See MySQL++. There are also several ODBC c++ classes, some free and some not. Just look at these links