Coder's Guild Mailing List

Re: ODBC/SQL

Posted by Dan Nuffer on 1999-06-16

From: Eian <ecounts@xxxx.xxx>
> I am attempting to access information in a Access database using
> ODBC with MSVC++ v5.0. Unfortunately, I am running into some
> rough problems. Can anybody point me to a good resource or give
> me some examples?
>

Are you using MFC or not?

If so, you can simply add a class using class wizard derived from
CRecordset.  You need to have your ODBC datasource setup on your computer
because Classwizard will open the database and let you specify which table
you want the class to be bound to, and then will create class data members
that correspond to the different fields of the table.  It's nice, you don't
even have to write the class, you can just use it and read the data out of
it.
To learn more go read the MSDN
(http://msdn.microsoft.com/library/default.htm) The information you need is
under Visual Studio 6.0 Documentation/Visual C++
Documentation/Reference/Microsoft Foundation Class Library and
Templates/Microsoft Foundation Class Library/Class Library
Reference/CRecordset

If you're not using MFC, then you can use OLE DB, which you can also find
under the MSDN under Visual Studio 6.0 Documentation/Visual C++
Documentation/Reference/Microsoft Foundation Class Library and Templates/OLE
DB Templates.

Dan Nuffer