Solved

ODBC Conversion

Posted on 1998-08-11
1
217 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 98
Detect CR LF to each line 12 176
WinWaitActive parameters 12 31
I could not set window to top 4 45
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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