Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to show data from database on Combo Box or List Box in Visual C++

Posted on 1999-09-01
3
Medium Priority
?
251 Views
Last Modified: 2013-11-20
Please somebody teach me,how to use Visual C++ to show data from database on Combo Box or List Box.
And please tell me the detail,contain the code how to write.
What should I use from Library,and what should I study in the MSDN.
Please,Thank you.
0
Comment
Question by:lky090199
[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
3 Comments
 
LVL 3

Expert Comment

by:Shay050799
ID: 2016719
what database u have?
do u know how to open/read the record into a buffer ?
0
 

Accepted Solution

by:
Andrian earned 40 total points
ID: 2024788
Acces Database
      CDaoDatabase *pDatabase = new CDaoDatabase;
      if (pDatabase != NULL)
      {
             try
            {
                  strcpy(szPassWord,";PWD=yourpassword");
                  pDatabase->Open(szDBFileName,FALSE,FALSE,szPassWord);
            }
            catch(...)
            {
                  //error
            }
            CDaoRecordset * pRecord=new CDaoRecordset(NULL);
            CDaoQueryDef * pRequetSQL=new CDaoQueryDef(pDatabase);
            COleVariant vFieldName;
            //strRequet.Format("SELECT RefFaute,Valeur FROM REGLE_FAUTE WHERE TypeFaute=\"%s\" ",strTypeFaute);
            try
            {
                   pRequetSQL->Create(_T(""),strRequet);
                  pRecord->Open( pRequetSQL);
            }
            catch(...)
            {
                  //error
            }
            CString strField;
            while(!pRecord->IsEOF())
            {
                  vFieldName=pRecord->GetFieldValue("FieldName");
                  strField.Format("%s",(char*)vFieldName.pbVal);
                  m_List.AddString(strField);
                  pRecord->MoveNext();
            }
       pRequetSQL->Close();
      pRecord->Close();      
      pDatabase->Close();      
      delete pRequetSQL;
      delete pRecord;
      }
0
 

Author Comment

by:lky090199
ID: 2026510
I can't understand about where the code to write.
In Visual C++,Should I write it in the Combo box or the DocumentView???
Thanks.....Bow
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

660 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