15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


DAO databases

Jim Volker -- jvolker@goodnet.com
Friday, July 12, 1996

WinNt40B2 VC4.1 Access7

Boring Background:
I have given myself a mission to understand DAO.  I already have used ODBC with
Borland products, and Embedded SQL with Informix and straight C.

After refering to the latest Mike B. book, I have an adequate understand, that 
is, once the database is created.  I would like to use MFC/VC to create a simple
database.

Database info:
My app is will be a simple viewer of email, only four fields, From, Subject,
Data, and Text.  Thus, I would not mind if I was emailed a test database

Situation:
MSAccess7 refuses to help me create a database, one error another crops up.  So
I am trying to create a database thru VC.
- Do I need to use the DAO SDK to do this?
- Are there any examples of DAO DB creation in books or MSDN?
---------------------------------------------------------------------
 Jim Volker             | "Ah'm sorrah, Cap'n Kirk...but y' jes kinna
 Choice Hotels Int'l    |  fit annah muhr on th' floppy.  Y' jes kinna
 jvolker@goodnet.com    |  mess wi' th' lahws o' data compression!"
---------------------------------------------------------------------




Norman L Covington -- doubleM@cris.com
Monday, July 15, 1996

[Mini-digest: 4 responses]

>WinNt40B2 VC4.1 Access7

>Database info:
>My app is will be a simple viewer of email, only four fields, From, Subject,
>Data, and Text.  Thus, I would not mind if I was emailed a test database

>Situation:
>MSAccess7 refuses to help me create a database, one error another crops up.  So
>I am trying to create a database thru VC.
>- Do I need to use the DAO SDK to do this?

No, direct calls to the DAO SDK are not necessary. The documentation for
creating a database are within the manuals.

You would first use CDaoDatabase to create the database itself. Lookup
CDaoDatabase::Create(...). You would then use a CDaoTableDef object to add
your table(s) to the CDaoDatabase. When you initialize an instance of
CDaoTableDef you pass in a pointer of the CDaoDatabase. You would then use
CDaoTableDef::Create(...). After creation you would utilize that instance of
CDaoTableDef to create your fields. Look at CDaoTableDef::CreateField(...).
Then you would issue an append to the database via CDaoTableDef::Append().
You may wish follow the instruction found in MFC Library Reference (shown
below - taken from CDaoTableDef::Create entry):

"For more information on tabledefs, see the articles "DAO Tabledef" and "DAO
Tabledef: Using Tabledefs" in Programming with MFC. For related information,
see the topic "Create TableDef Method" in DAO Help."

This should get you on the road to creating successful databases. Hang in
there - DAO is a wish choice. You may want to consider adding a TIME/DATE
field for when the message was received, created, etc. You could use one or
more of those fields in conjunction with you TO/FROM for a primary index.

Norman L Covington

-----From: "GoroKhM1" 

WinNt40B2 VC4.1 Access7
     
The sample DAOTable in VC++4.1 or MSDN.

Mark Gorokhov
MarkG@usa.net

-----From: Paul Pettigrew 

Seriously, this newsgroup is for more advanced discussion.
If you cannot create a simple .MDB database file, with some tables in Access, then 
you still have a lot of reading to do, including the Access getting started manual.

[Moderator's note:  I thought he was asking how to do it through DAO.]

Sincerely,
--
Paul Pettigrew
chilli@iinet.net.au || pmpet2@mugc.cc.monash.edu.au

-----From: Yannick Skelling 

Hi Jim,

	Check-out the sample daotable in vc++. You just have to enter 
the name in the edit box and then click connect, it will prompt you for 
the version of the database. And you're on !

Bye


-- 
**********************************************************
* Yannick Skelling                                   \   *
* Analyst Programmer                                o_\  *
* Thermetrics Diagnosys Ltd.                        \__\ *
* diagnosys@vir.com                                  |  \*
*                                                        *
*          "Be a virus, see the world."  -Gary Larson    *
**********************************************************




| Вернуться в корень Архива |