DATAACCESSOBJECTS
ADVANCEDDATABASESASSIGNMENT
INDEX
CONTENTS PAGENO
1. INTRODUCTION1
1.1 WHATISADATAACCESSOBJECT1
.2 HOWDOESDAOWORK1 1
.2 DATABASEENGINES
2.1 MICROSOFTJETDATABASEENGINE1
2.2 ODBCDirectDATABASEENGINE2
.3 HISTORYOFDAO2
.4 ADVANTAGESANDDISADVANTAGESOFUSINGDAO2
.5 IMPLEMENTINGDAOUSINGDATACONTROLINVISUALBASIC3
.6 ANEXAMPLECODE
6.1 LIBRARYMANAGEMENTSYSTEM–CODE11
6.2 SCREENSHOTS13
.7 DEFINITIONS
1. INTRODUCTION
1.1 WHATISADATAACCESSOBJECT(DAO)?
A data access is an interface that communicates with Microsoft Jet and
ODBC‐compliant data sources to connect to, retrieve, manipulate, and update
dataan sdthedataba estructure.
DAO, which was created before RDO and ADO, is a set of objects that
enablesclientapplicationstoprogrammaticallyaccessdata.ButDAOdoesn'tjust
let you access data—it also lets you control and manage local and remote
databasesinvariousformats.UsingDAO,youcancreateandmodifythedatabase
structure;createtables,queries,relationships,andindexes;retrieve,add,update,
andremovedata;implementsecurity;workwithdifferentfileformats;andlink
tablestoothertables.
1.2 HOWDOESDAOWORK?
DAO works by creating a "Workspace" object in which all database
operationsareperformed.Theworkspaceobject existsasa sessionobjectthat
existswithinalargerdatabaseengineobject.
Therea ngines:retwofrequentlyuseddatabasee
• aJetdatabaseengineobject,and
• AnODBCDirectdatabaseengine.
2. DATABASEENGINES:
2.1 MICROSOFTJETDATABASEENGINE
TheMicrosoftJetDatabaseEngineisadatabaseengineonwhichseveral
Microsoft products operate. The Jet database engine object consists of several
objects:
• aworkspaceobjectcontainingagroupsandusersobject
• Recordsetobjectswhicharedefinedbyasetoffieldobjects
• Relationobjectswhichshowtherelationshipbetweendifferentfieldsin
thedatabase
• Table definition objects which consists of fields and indexes of selected
fields.
2.2 ODBCDirectDATABASEENGINE
TheODBCDirectdatabaseengineconsistsofaworkspaceobjectand an
errors object. The main differences between this database engine and the Jet
databaseengineare:
• tionobjectstheworkspaceobjectcontainsonlyaseriesofODBCconnec
• thedatabaseobjectconsistsofaseriesofRecordsetobjects
3. HISTORYOFDAO:
DAOs were originally called VT Objects. DAO 1.0 came up in November
1992.Inversion3.5itwasabletobypasstheJetenginealtogetheranddirectly
accessODBCdatasources,includingMicrosoftSQLServerandotherenterprise
database systems. DAO 3.6 was the final version developed by Microsoft. DAO
hasbeenremovedfromtheWindowsOperatingSystemsbutcanbeaddedasan
additionalcomponent.
4. ADVANTAGESANDDISADVANTAGESOFUSINGDAO:
Ontheplusside,DAOisfairlyeasytouse.AndsinceDAOhasbeenaround
longerthanRDOorADOandhasbeenusedinmoreprojects,itpays to know
how DAO works. Furthermore, if your application is running in a 16‐bit
environment,DAOisyouronlychoice.
ButDAOisoldertechnology,anditdoesn'tofferasmuchfunctionalityas
RDOandADO.Forinstance,ADOcanprovideaninterfacetoe‐mail and file
systemsandcustombusinessobjects,aswellasothersources.Microsoftisnow
focusingmostofitsimprovementsandadvancesonADO,aswell.
Generally,it'sbettertouseDAOforaccessinglocaldatabaseswherethe
speedisnotthetoppriorityandthenumberofusersislimited,andtouseeither
RDOorADOforaccessingremotedatabasesandforlargerscaleprojects.
5. MPLEMENTINGDAOUSINGDATACONTROLVISUALBASIC:I
The Data Control, which is a default control present in the Toolbox,
simplifiesthetask.TheVisualBasic6.0Datacontrolisusedasamechanismfor
binding controls to a database using DAO. The Data control alsoprovidesan
interfacefornavigatingdata,withbuttonsformovingbackandforththrough
rowsinadatabasetable.TheDataControlhasbeenremovedfrom the newer
versionsofVisualBasic.VisualBasic2005hasnoequivalentfortheDatacontrol
sincethedata‐bindingarchitecturehaschangedandDAOisnolongersupported.
TheDatacontrol,bydefault,usestheJETdatabaseengine.
The Step‐by‐Step tutorial about howtouseDAOinVisualBasic6.0 is
givenbelow:
1. StartVisualBasic6.0
2. SearchfortheDataControlintheToolbox.DoubleClickonittoadditto
theform.
DATACONTROL