Thread: Database Access

  1. #1
    Registered User
    Join Date
    Sep 2001

    Question 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!


  2. #2
    Registered User
    Join Date
    Sep 2001
    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.


    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error connecting from Dev C++ to MS Access Database
    By Sridar in forum C++ Programming
    Replies: 0
    Last Post: 04-15-2006, 06:09 PM
  2. accessing a database made in Access..
    By willc0de4food in forum Windows Programming
    Replies: 4
    Last Post: 10-10-2005, 07:40 PM
  3. Access Database Editor
    By Grayson_Peddie in forum Tech Board
    Replies: 21
    Last Post: 01-06-2004, 07:20 AM
  4. DataBase access
    By itld in forum C++ Programming
    Replies: 2
    Last Post: 12-29-2001, 08:25 PM
  5. DataBase Access
    By itld in forum Linux Programming
    Replies: 0
    Last Post: 12-29-2001, 11:40 AM