Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

ODBC Conversion

Posted on 1998-08-11
1
212 Views
Last Modified: 2013-11-20
I want to convert an existing project to support ODBC how do I do it ?
0
Comment
Question by:guranimo
1 Comment
 
LVL 9

Accepted Solution

by:
Priyesh earned 20 total points
ID: 1320561
Please add #include <afxdb.h> in stdafx.h and
try using CDatabase and CRecordset classes.
For eg: see this.
               try
            {
            CDatabase db;
            db.OpenEx(_T( "DSN=XXX"),
                               CDatabase::openReadOnly |
                               CDatabase::noOdbcDialog ) ;
            CRecordset rs(&db);
            rs.Open(CRecordset::forwardOnly,
                         _T("SELECT trade FROM SUPERNDC"));
            CString csWord ;
            char chSx[5] ;
            while( !rs.IsEOF() )
            {
                  rs.GetFieldValue("trade", csWord);
                  if(Soundex((LPSTR)(LPCTSTR)csWord, chSx))
                        m_oList.AddItem((LPSTR)(LPCTSTR)csWord, chSx) ;
                  rs.MoveNext();
            }
            rs.Close();
            db.Close();
            }
            catch(CDBException* pExp)
            {
                  pExp->ReportError() ;
            }      

The above code can be used in a function to get instant access to a table and get data.. i used it to load data from a dictionary table to my data structure.. This should help u.
       Regards...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question