VB的相关中英文文献对照文档格式.docx
《VB的相关中英文文献对照文档格式.docx》由会员分享,可在线阅读,更多相关《VB的相关中英文文献对照文档格式.docx(18页珍藏版)》请在冰豆网上搜索。
ThroughMicrosoftJetDatabaseEngine(Jetdatabaseengine),DAO(DataAccessObject)thetechnologymainlyprovidesvisittoISAM(smoothindexsearchmethod)typedatabase,likerealizationvisittodatabaseandsoonFoxPro,Access,Dbase.
1.1usesDatatocontrol
Datacontrolsareusesinthetoolbox“Data”thebuttontoproduce.Shouldcontroltohave3basicattributes:
Connect,DatabaseNameandRecordSource.Connectattributespecifieddatacontrolsthedatabasetypewhichmustvisit,thedefaultistheAccessdatabase;
TheDatabaseNameattributevalueforcontainsthecompletewaythedatabasefilename;
TheRecordSourceattributevaluefortherecordcompendiumwhichmustvisit,maybeshows,butalsoSQLsentence.IfvisitsunderDplateTEMPfolderteachermdbinthedatabasefiletablestud,thenDatacontrolstheConnectattributeforspatially,theDatabaseNameattributeis“D:
\temp\teachermdb”,theRecordSourceattributevalueis“stud”.LikethisrealizedDatatocontrolandbetweenthedatabaserecordingdatabinding,throughtransferredDatatocontrolmethodrealizationsandsoontheAddnew,Update,Delete,Movelastvisittothedatabaseeachkindofrequest,whencarriedonthedatabasecontentbrowsing,DatacontrolledalsofrequentlytocontrolthecoordinateusewithDegrade,providedthegridwaythedatainquiry.
1.2usestheDAOobjectstorehouse
TheDAOobjectstorehousemodelmainlyusesthehierarchicalstructure,Dentineisthetopmoststoryobject,belowhasErrorsandtheworkspacetwoobjectsets,undertheworkspaceobjectistheDatabasesset.QuotestheDAOobjectstorehousewhentheapplicationprocedure,onlycanproduceaDentineobject,andproducesadefaultautomaticallyworkingspaceobjectworkspace,inotherhasnotassignedinthesituation,alldatabaseoperationallisinworkspace(0)carriesoutinthedefaultworkarea,butmustpayattention:
TheJetenginestartsafterVBcannotloadautomatically,onlythenchoosesReferencesintheProjectmenuitem,thenselectsMicrosoftDAO3.5ObjectLibraryonlythentobepossibletouse.usestheCreateDatabasemethodfoundationdatabaseinDAO,withtheCreateTableDefmethodfoundationtable,opensthedatabasewiththeOpenDatabasemethodwhichassigns,openstherecordcompendiumwiththeOpenrecordsetmethod,usesAddnew,Update,Delete,Movefirst,Editmethodsandsoonrecordsetobjecttobepossibletorealizefortableeachkindofoperation.
ThroughtheDAOothermethodtransfer,mayrealizetothetableotheroperations.
1.RDOtechnology
RDOisprovidestorelatestheODBCdatapoolvisitconnection.WhenneedstovisitotherdatabaselikeSQLServer,Oracle,whenspeciallyneedstoestablishthecustomer/serverapplicationprocedure,mayusethelongrangedatatocontrolRDC(RemoteDataControl)andlongrangedataobjectRDO(RemoteDataControl)realizesthroughtheODBCdrivervisittothedatabase.
UsesODBCvisitswhensomedatabasemustfirstinstallthecorrespondingdriver,establishesadatapool,throughdatapoolvisitcorrespondingdatabasewhichassigns.EstablishestheODBCdatapoolisturnson“thecontrolpanel”thewindow,double-clickstheODBCexecutiveprogramtheicon,inopensintheODBCdatapoolsupervisordialogboxsingle-clicks“Add”thebuttontofoundthedatapool,andchoosescorrespondingdatabase.
2.1usesRDCtocontrol
ControlswithDATAtobeverysimilarintheuse,assignswiththeDatasourcenameattributetocontrolabindingthedatasourcename,assignstherecordcompendiumwiththeSQLattribute,differentis,controlsintheSQLattributeinRDCtohavetousetheSQLsentencetoassign.WhendatabasebrowsingalsofrequentlycontrolstheunionusewithDBGrid.
2.2usestheRDOobjectstorehouse
InusesinfrontoftheRDOobject,shouldchooseReferencesintheProjectmenuitem,afterselects“MicrosoftRemoteDataObject2.0”onlythentobepossibletouse.
usesRDOtovisittheODBCdatapoolthestepis:
(1)EstablishesaRDOenvironmentobject.
(2)UsestheOpenconnectionmethodtoopenanODBCdatapool.
(3)UsestheOpenResultsetmethodtoestablishtheresultcollectionobject.
(4)Useassignsthemethod,carriesoneachkindofoperationtotheresultcentralismrecording.
Afterfoundstheasthisresultcollectionobject,issimilarwiththeDAOobjectstorehouseuse,maythroughtransfermethodrealizationsandsoonitsAddnew,Update,Deletevisittoassignthedatapooleachkindofrequest.
3.ADOtechnology
ADO(ActiveXDataObjects)istheMicrosoftmostrecentdataaccessingtechnology,heusesgeneraldataaccessingconnectionUDA(UniversalDataAccess),alldatastandardwillbeonekindofdatapool,passesthroughOLEtheDBconnectionfiltration,transformsonekindofgeneraldataformatbythesameway,enablestheapplicationproceduretovisitthiskindofdata.OLEDBisanunderlyingbeddataaccessingconnection,mayvisiteachkindofdatapoolwithhim,includingtraditionalrelationsdatabase,aswellaselectronicmailsystemandfromdefinitioncommercialobject.
3.1usesADOtocontrol
single-clickstheComponentsorderintheProjectmenu,selects“MicrosoftADODataControlintheComponentsdialogbox6.0(OLEDB)”,maycontrolADOtoincreasetocontrolsinabox.
controlstheConnectionstringattributethroughADOtoestablishthedatabasefilewhichOLEDBProviderandassigns,theRecordSourceattributeestablishesADOtocontroltheconnectedrecordsource.AresimilarwithDAOandRDO,controlsthroughADOwiththerecordingsourceconnection,mayrealizetoeachkindofdatabasefastaccess.
3.2usestheADOobjectstorehouse
Single-clickstheReferencesorderintheProjectmenu,selects“MicrosoftActiveXDataObjects2.0Library”intheReferencesdialogbox,mayincreaseintheprojecttotheADOobjectstorehousequotation.
Beforehandobjectmodel,likeDAOandRDOallarethelevel,lowdataobjectlikeRecordsetisseveralhighlevelobjectlikeEnvironmentandtheQueriedsub-object.ButADOisactuallydifferent,hehasdefinedagroupofplanetopobject,themostimportant3ADOobjectisConnection,RecordsetandCommand.
TheConnectionobjectusesinestablishingtheapplicationprocedureandthedatapoolconnection;
TheCommandobjectusesindefiningaSQLsentence,amemoryprocessorothercarriesontheoperationtothedatatheorder;
AftertheRecordsetobjectpreservationexecutionorderreturnsrecordcompendium.
ThroughtransferstheRecordsetobjectthealternativemeans,mayrealizetooperationsandsoonrecordcompendiumrevision,deletion,inquiry.
4conclusions
VBprovidedtheverymanymethodrealizationtothedatabaseoperation,inwhichDAOmainrealizationvisittoISAMdatabase,RDOhasprovidedtotheODBCdatapoolconnection,RDOandDAOallhasdevelopedforthequitematuretechnology,inVBinfrontof6.0isthemaindatabasevisittechnology,butActiveDataObjects(ADO)therecentgenerationofdatabaseinterfacewhichpromotesasMicrosoft,isdesignedwithrecentdataaccessinglevelOLEDBtheProvidertogetherjointoperation,providesthegeneraldataaccessing(UniversalDataAccess),hehasprovidedverymanyadvantagetotheVBprogrammer,includingeasytouse,thefamiliarcontactsurface,thehighvelocityaswellasthelowmemorytakes(HasrealizedADO2.0Msado15.dlltoneedtotakethe342Kmemory,isslightlysmallerthanRDOMsrdo20.dll368K,probablyisDAO3.5Dao350.dlloccupiesthememory60%),asaresultofabovereason,ADOgraduallywillreplaceotherdataaccessingconnection,willbecometheVBvisitdatabasethefundamentalmode.
VB的数据库编程方案分析
VB(VisualBasic)是微软公司推出的基于Basic语言的可视化编程环境,以其简单易学、功能强大而倍受广大电脑爱好者的青睐,许多应用软件都采用VB作为软件开发平台。
在用VB开发应用软件的过程中,如何使用数据库并对数据库进行管理是所有开发者关心的问题。
VB为数据库的编程提供了很多的工具和方式,究竟采用何种方式进行数据库的访问依赖于用的不同需求,以下就对VB的数据库编程方式做一个简单剖析。
1.DAO技术
通过Microsoft的JetDatabaseEngine(Jet数据库引擎),DAO(DataAccessObject)技术主要提供对ISAM(顺序索引查找方法)类型数据库的访问,如实现对FoxPro,Access,Dbase等数据库的访问。
1.1使用Data控件
Data控件是利用工具箱中的“Data”按钮产生的。
该控件有3个基本属性:
Connect,DatabaseName和RecordSource。
其中Connect属性确定数据控件要访问的数据库类型,默认为Access数据库;
DatabaseName属性的值为包含完整路径的数据库文件名;
RecordSource属性值为要访问的记录集,可以是表,也可是SQL语句。
如访问D盘TEMP文件夹下的teachermdb数据库文件中的表stud,则Data控件的Connect属性为空,DatabaseName属性为“D:
\temp\teachermdb”,RecordSource属性值为“stud”。
这样就实现了Data控件和数据库记录之间的数据绑定,通过调用Data控件的Addnew,Update,Delete,Movelast等方法实现对数据库的各种访问要求,在进行数据库内容浏览时,Data控件还经常和DBGrid控件配合使用,提供网格方式的数据查询。
1.2利用DAO对象库
DAO对象库的模型主要采用层次结构,Dentine是最高层的对象,下面有Errors和workspace两个对象集合,在workspace对象下是Databases集合。
在应用程序引用DAO对象库时,只会产生一个Dbengine对象,并自动生成一个默认的工作空间对象workspace,在没有另外指定的情况下,所有的数据库操作都是在默认工作区workspace(0)中执行的,但要注意:
Jet引擎在VB启动后不会自动装入,只有在Project菜单项中选择References,然后选中Microsoft
DAO3.5ObjectLibrary才可以使用。
在DAO中使用CreateDatabase方法创建数据库,用CreateTable方法创建表,用OpenDatabase方法打开指定的数据库,用Openrecordset方法打开记录集,使用recordset对象的Addnew,Update,Delete,Movefirst,Edit等方法可实现对表的各种操作。
通过DAO其他的方法调用,可实现对表的其他操作。
2.RDO技术
RDO是提供对关系型ODBC数