-
Database Access
I am trying write a simple prog to loop through a recordset from a ODBC datasource. I was wondering if anyone could show me or point me to an exapmle (in its simplest terms) to open a database connection, execute an SQL query, then loop through the recordset.
I wrote this in VBScript in less than 20 lines, but it seem to be vastly more complicated in c++, or I am just getting the wrong info?
Someone pretty please help!
Randall
-
I'm guessing your using VC++. The good news yes you can, the bad news is the plumbing is not trivial. I recommend using MFC and its CDatabase and CRecordset classes or and more likely a better approach would be using ATL OLE DB.
You can look these up on MSDN there are lots of ODBC and OLE DB samples. As a starting point I'd look for "Creating an OLE DB Consumer" and "Creating an OLE DB Template Provider".
There are also some good books on it such as "OLE DB and ODBC Developer's Guide". It covers both.
I hope that helps.
dang
This is a duplicate reply... for what ever that's worth. Another person on the board is accessing excel. The priciples and plumbing would be fairly similar. Maybe you could get with him and help each other out.