New Access Database from Delphi

Page 1: Delphi, ADOX and ADOExpress against MS Access.

Chapter 11 of this course (Free Delphi Database Course for Beginners - focus on ADO techniques) featured the ADOCommand component which is most often used for executing data definition language (DDL) SQL commands. We've presented a way of porting your existing Paradox/BDE tables to MS Access. However few questions have stayed unanswered: how to create an empty Access database, how to add an index to an existing table, how to referential integrity,

More of this Feature

• Page 2: Create.Database

Join the Discussion

"Post your views and comments to this chapter of the free Delphi database Programming Course" Discuss!

Related Resources

  • free DB Course.TOC
  • Queries with ADO
  • a href="http://delphi.about.com/library/weekly/aa060199.htm"> SQL with Delphi
  • a href="http://delphi.about.com/cs/database/index.htm"> more Database articles

join two tables with

  • a href="http://delphi.about.com/cs/beginners/">Beginners Here
  • a href="http://delphi.about.com/cs/comoleactivex/">COM/OLE/ActiveX

Database

Many of the attendees of this course have complained that they do not have MS Access installed on their computer - and are unable to create a sample database (aboutdelphi.mdb) that is presented in the first chapter and used through this course.

Distrubuted comp.

In this chapter, we'll again focus on the TADOCommand and the

Game Programming Graphics Internet/Intranet Mathematics Multimedia Delphi Pascal/IDE Screen saver dev. VCL Using VCL Write/Enhance Web Services Windows/Shell/API Kylix (D on Linux)

Coding standards Books/Publications Dev. Utilities FAQs/Tips/Tricks Free Code Projects Humor and Fun Icons and Glyphs Jobs and Offers Training/CD/Video VCL & Tools

Subject Library

All articles on this topic

ADOX to see how set up an empty MS Access database from "nothing".

ADOX

As stated in the mentioned chapter, ADO Extensions for Data Definition Language and Security is an extension to the ADO objects and programming model. ADOX gives developers a rich set of tools for gaining access to the structure, security model, and procedures stored in a database.

Even though ADOX is part of ADO, Delphi does not wrap it inside ADOExpress. To use ADOX with Delphi, you should establish a reference to the ADOX type library. The description of the ADOX library is "Microsoft ADO Ext. for DDL and Security." The ADOX library file name is Msadox.dll. You'll have to import the ADOX library into the IDE.

To use ADOX in Delphi, you should establish a reference to the ADOX type library.

  1. Select Project | Import Type Library
  2. Choose "Microsoft ADO Ext 2.x for DDL and Security (Version 2.x)"
  3. Change "TTable" to "TADOXTable" 3b. Change "TColumn" to "TADOXColumn" 3c. Change "TIndex" to "TADOXIndex" 3d. Change "TKey" to "TADOXKey" 3e. Change "TGroup" to "TADOXGroup" 3f. Change "TUser" to "TADOXUser" 3g. Change "TCatalog" to "TADOXCatalog"
  4. Press Install button (rebuilding packages)
  5. Press OK once and Yes twice
  6. File | Close All | Yes

This process creates a ADOX_TLB.pas unit and places its name in the uses clause of the current project. The process also places 7 new components on the ActiveX page of the component palette. It is very important to change the class names as described in step 3. If you omit that part Delphi will complain that class TTable is already defined - this is because the VCL already has the BDE version of TTable component.

aboutdelphi.mdb

Before we move on, you should recall that our sample aboutdelphi.mdb database has three tables: Application, Authors and Types. Both Authors and Types are child tables to Applications. Both Authors and Types have a primary index.

Stay up-to-date!

Subscribe to our newsletter.

Enter Email

Advertising

> Free Credit Report

> Free Psychics

Next page > Create Database from Delphi > Page 1, 2

DB Course Next Chapter >>

>> Charting with Databases

All graphics (if any) in this feature created by Zarko Gajic.

More Delph

  • Learn another routine every day - RTL Quick Reference.
  • Download free source code applications and components.
  • Talk about Delphi Programming, real time. Start a chat now!
  • Link to the Delphi Programming site from your Web pages.
  • Tutorials, articles, tech. tips by date: 2001120001199911998 or by TOPIC.
  • NEXT ARTICLE: A more powerful Delphi Form.

Messing with the creation process of a form object, or how to change the default style of a window when it gets created to suit your particular needs.

Stay informed with all new and interesting things about Delphi (for free).

Subscribe to the About Programming Newsletter

Name Email subscribe

Got some code to share? Got a question? Need some help?

Recent Discussions_

Delphi Programming

Join these forum conversations

Extracting digital audio from cd Delphi disadvantages compared to VS.Net Keep An Application Always On Top Delphi7 adoblob problem Searching in a text file or wide string

Email this page!

Was this article helpful?

0 0

Responses

Post a comment