Creating a Data Base in VC++ 
Author Message
 Creating a Data Base in VC++

We need to create a data base under Visual C++ without a user interface.
It should be a simple DB created from a file based on normal C structures,
such as: struct A { int x; int y; CString s; }; and it should be created
from within the application itself and NOT via Microsoft Access.
We would like to be able to add records according to a specific key,
and then update them if necessary. From the help and examples we found in
Books On Line, we couldn't make out how exactly to go about it in a dialog
based application ( no docs, no views, no nothing ).
Any help would be appreciated, especially if a small example comes with it.

--
---Beware the Jabberwock, my son!---
------Ian Kojurin-------



Sat, 16 Oct 1999 03:00:00 GMT  
 Creating a Data Base in VC++

A nice start would be to check out the documentation for MFC's DAO database
classes and the MS Jet engine...

Bendik



Sat, 16 Oct 1999 03:00:00 GMT  
 Creating a Data Base in VC++

Quote:
>we couldn't make out how exactly to go about it in a dialog
>based application ( no docs, no views, no nothing ).
>Any help would be appreciated, especially if a small example comes with it.

Fire up the app wizard and let it generate a dialog-based app, then
make the dialog invisible.  Or, let the app wizard generate a console
app (with no windows interface at all).

Josh



Fri, 22 Oct 1999 03:00:00 GMT  
 Creating a Data Base in VC++

try{

// create the database
CDaoDatabase    Database;      
Database.Create( szDBName );

// create the table
CDaoTableDef    Table(&Database);
Table.Create(szTableName );                    

// create 2 fields
Table.CreateField( "Field 1", dbText, 20);                            
Table.CreateField( "Field 2", dbMemo, 300);
Table.Append();

// create the record set
CDaoRecordset   DaoRecordset;
DaoRecordset.Open(&Table);

// add a new record
DaoRecordset.AddNew();
DaoRecordset.SetFieldValue("Field 1", "value1 " );
DaoRecordset.SetFieldValue("Field 2", "value2 " );          
DaoRecordset.Update();                                  

DaoRecordset.Close();
Table.Close();          
Database.Close();

Quote:
}

catch( CDaoException* pE )
{
        pE->ReportError();
        pE->Delete();

Quote:
}

Niall



Quote:
> Microsoft Press has a book, "Microsoft Jet Database Engine Programmer's
> Guide" with a CDROM that I found very helpful in getting code running to
> construct and access databases from VC++.
> --
> Eldon Ziegler
> HomAtion Systems

> http://www.homation.com



> > We need to create a data base under Visual C++ without a user
interface.
> > It should be a simple DB created from a file based on normal C
> structures,
> > such as: struct A { int x; int y; CString s; }; and it should be
created
> > from within the application itself and NOT via Microsoft Access.
> > We would like to be able to add records according to a specific key,
> > and then update them if necessary. From the help and examples we found
in
> > Books On Line, we couldn't make out how exactly to go about it in a
> dialog
> > based application ( no docs, no views, no nothing ).
> > Any help would be appreciated, especially if a small example comes with
> it.

> > --
> > ---Beware the Jabberwock, my son!---
> > ------Ian Kojurin-------




Tue, 02 Nov 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Creating a Data Base in VC++

2. vc++ DATA BASE READ

3. creating a control in code based on data in resource

4. Comma delimited file into an access data base using VC++

5. HOW TO PRINT ONLY DATA IN DIALOG BASED APLLICATION in VC++ --can mfc help

6. Creating a DB in vc based on existing DB

7. Creating HTML - based application in VC 6.0

8. Creating a DB in vc based on existing MS Access DB

9. Creating Dialog based apps in VC++ 1.52

10. Creating a MS Word Mail Merge data file from VC++

11. data base nightmare

12. Data base

 

 
Powered by phpBB® Forum Software