interfacing microsoft access 
Author Message
 interfacing microsoft access

Hi,
i am trying to interface a very simple microsoft access database
from a C++ application, i don't need to use interface. Basically,
iwould like to read and write to this database from my
application.

           does anyone have any idea?
           thanks

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.*-*-*.com/ ;  The website for Visual C++ programmers.



Sat, 29 Sep 2001 03:00:00 GMT  
 interfacing microsoft access

I've used MFC's CDaoDatabase functions for this sort of thing - I don't know if this is the best way for your project, but it works for me--

You have to add a new MFC class with a base class of CDaoRecordset. Under Database Options, choose DAO and the path and file name of the database.  Next, it will ask you to select a table.

In your main app header, you need a pointer to the database and a way to get to it:
CDaoDatabase            *m_database;
CDaoDatabase* GetDb() {return m_database; };

In your function using the database, you need to get it:
mydatabase = theApp.GetDb();

Then create a new instance of your recordset:
MyRecordset *pMyRecordset;
pMyRecordset = new MyRecordset(mydatabase);

Then open it for use:
pMyRecordset->Open();

See the CDaoRecordset help for filtering, sorting, editing, etc.

Quote:

>Hi,
>i am trying to interface a very simple microsoft access database
>from a C++ application, i don't need to use interface. Basically,
>iwould like to read and write to this database from my
>application.

>           does anyone have any idea?
>           thanks

>-----------------** -- Posted from CodeGuru -- **-----------------
>http://www.codeguru.com/    The website for Visual C++ programmers.

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.codeguru.com/    The website for Visual C++ programmers.


Sun, 30 Sep 2001 03:00:00 GMT  
 interfacing microsoft access
All of this is set up by the new project wizard if database support is
selected when the wizard is run.

The DAO functions are fast, especially when using table mode for recordsets.

Quote:

>I've used MFC's CDaoDatabase functions for this sort of thing - I don't

know if this is the best way for your project, but it works for me--
Quote:

>You have to add a new MFC class with a base class of CDaoRecordset. Under

Database Options, choose DAO and the path and file name of the database.
Next, it will ask you to select a table.
Quote:

>In your main app header, you need a pointer to the database and a way to
get to it:
>CDaoDatabase *m_database;
>CDaoDatabase* GetDb() {return m_database; };

>In your function using the database, you need to get it:
>mydatabase = theApp.GetDb();

>Then create a new instance of your recordset:
>MyRecordset *pMyRecordset;
>pMyRecordset = new MyRecordset(mydatabase);

>Then open it for use:
>pMyRecordset->Open();

>See the CDaoRecordset help for filtering, sorting, editing, etc.


>>Hi,
>>i am trying to interface a very simple microsoft access database
>>from a C++ application, i don't need to use interface. Basically,
>>iwould like to read and write to this database from my
>>application.

>>           does anyone have any idea?
>>           thanks

>>-----------------** -- Posted from CodeGuru -- **-----------------
>>http://www.codeguru.com/    The website for Visual C++ programmers.

>-----------------** -- Posted from CodeGuru -- **-----------------
>http://www.codeguru.com/    The website for Visual C++ programmers.



Wed, 03 Oct 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. interfacing a Microsoft Access Database

2. simple interface to microsoft access?!

3. C++ programmatic access to Microsoft Access object model?

4. Accessing queries through Microsoft Access automation

5. Using ADO with CADORecordBinding for accessing an Microsoft Access

6. MSSCI - Microsoft Source Code Control Interface

7. Microsoft Source Code Control Interface

8. CVS or Microsoft Source-Control Interface information???

9. Microsoft Common Source-Code Control Interface

10. Interfacing Visual C++ with Microsoft Excel

11. Interface to Microsoft Word

12. Microsoft Press, Visual C# Step by Step Chapter 31 Data Access

 

 
Powered by phpBB® Forum Software