外文文献及翻译2篇.docx
- 文档编号:8302894
- 上传时间:2023-01-30
- 格式:DOCX
- 页数:11
- 大小:39.58KB
外文文献及翻译2篇.docx
《外文文献及翻译2篇.docx》由会员分享,可在线阅读,更多相关《外文文献及翻译2篇.docx(11页珍藏版)》请在冰豆网上搜索。
外文文献及翻译2篇
学生公寓智能化管理系统——学生与房间管理子系统外文文献及翻译
学生姓名:
周宇杰
学号:
07111237
专业:
软件工程
学院:
软件学院
指导教师:
姜林
职称:
讲师
东华理工大学软件学院
二零一一年五月十日
ANALYSISOFDATABASEPROGRAMMINGINVB
VB(VisualBasic)isavisualizationprogrammingenvironmentthatMicrosoftCorporationpromotesbasedontheBasiclanguage.Itissimpleandeasytostudy.Ithasformidablefunctionsothatmanycomputeramateursreallylikeit.AlotofapplicationsoftwaresalluseVBasthesoftwaredevelopmentplatform.WhenweuseVBtodeveloptheapplicationsoftware,howtousethedatabaseandcarryonthemanagementofthedatabaseisconcernedbyallexploiters.VBhasprovidedmanytoolsandmethodsfordatabaseprogramming.Whatmethodisusedtovisitthedatabasedependsonusers’differentdemands,asimpleanalysisoftheVBdatabaseprogrammingisexplainedasfollowings.
1.DAOTechnology
ByusingMicrosoftcompany’sJetDatabaseEngine(Jetdatabaseengine),DAO(DataAccessObject)thetechnologymainlyprovidesvisittoISAM(smoothindexsearchmethod)typedatabase,suchastherealizationofthevisittodatabaselikeFoxPro,Access,Dbase.
1.1UseDataControls
Datacontrolsareproducedbyusing“Data”buttoninthetoolbox.Ithas3basicattributes:
Connect,DatabaseNameandRecordSource.Connectattributespecifysthedatabasetypethatdatacontrolsvisit,thedefaultdatabaseistheAccessdatabase.ThevalueoftheDatabaseNameattributeisthedatabasefilenamewhichcontainsthecompletepath.TheRecordSourceattributeistherecordsetthatwevisit,alsocanbetablesorSQLsentences.IfwewillvisittablestudofdatabasefileteachermdbofTEMPfolderunderDplate,thenDatacontrols’sConnectattributeisnull,andtheDatabaseNameattributeis“D:
\temp\teachermdb”,thevalueoftheRecordSourceattributeis“stud”.ThiscanaccomplishthebindingbetweenDatacontrolsanddatabaserecords.ThroughthemethodsofDatacontrolslikeAddnew,Update,Delete,Movelast,wecanvisitthedatabaseaseveryrequest.Whenwebrowsethecontentindatabase,DatacontrollsisusedfrequentlywithDBGrid,itprovidesdatainquiryingridway.
1.2UseDAOObjectStorehouse
ThemodeloftheDAOobjectstorehouseismainlyusinghierarchicalstructure,Dentineistheobjectinthetopmoststory,belowitaretwoobjectsets,Errorsandworkspace,undertheworkspaceobject,istheDatabasesset.WhentheapplicationprocedurequotestheDAOobjectstorehouse,itproducesonlyaDentineobject,andproducesadefaultautomaticalworkingspaceobjectnamedworkspace.Whennotmentioned,alldatabaseoperationsareallworkinworkspace(0),whichisadefaultworkarea.Butwemustpayattention:
TheJetenginewillnotstartsautomaticallyafterVBhasbeenloaded.OnlywhenwechooseReferencesinthemenuofProjectcanweselectMicrosoftDAO3.5ObjectLibrarytouse.Wecreatedatabaseswiththemethod“CreateDatabase”inDAO,use“CreateTable”methodtobulidtables,usethe“OpenDatabase”toopenthedatabase,use“Openrecordset”methodtoopenrecordset,useAddnew,Update,Delete,Movefirst,Editmethodstorealizeeachkindofoperationsabouttables.
2.RDOTechnology
RDOprovidesaconnectiontorelatedODBCdatapool.WhenweneedtovisitotherdatabaseslikeSQLServer,Oracle,especiallytoestablishthecustomer/serverapplicationprocedure,wemayusethelongrangedatacontrolsRDC(RemoteDataControl)andlongrangedataobjectsRDO(RemoteDataControl)torealizethevisittothedatabasethroughtheODBCdriver.
ByusingODBCtovisitsomedatabasewemustfirstinstallthecorrespondingdrivers,likeestablishadatapool,throughassigneddatapooltovisitcorrespondingdatabase.ToestablishtheODBCdatapoolisopenthewindowof“thecontrolpanel”,double-clickstheiconofODBCexecutiveprogram,single-click“Add”buttontocreatethedatapooloftheopeningODBCdatapoolsupervisordialogbox,andchoosecorrespondingdatabase.
2.1UseRDCControls
SimilartotheuseofDATAControls,weuseDatasourcenameattributestoassignthedatasourcenamethatcontrolsbind,andweuseSQLattributestoassigntherecordset,Thedifferenceisthat,wehavetousetheSQLsentencestoassigntheSQLattributeinRDCControls.WhenwebrowsethedatabasewemayfinditisusedwithDBGridfrequently.
2.2UseRDOObjectStorehouse
BeforeweuseRDOobject,weshouldchooseReferencesinthemenuofProject,click”MicrosoftRemoteDataObject2.0”,thenwecancontinue.
ThestepweuseRDOtovisittheODBCdatapoolis:
(1)SetaRDOenvironmentobject.
(2)OpenanODBCdatapoolwiththemethodofOpenconnection.
(3)EstablisharesultobjectwiththemethodofOpenResultset.
(4)Useassignedmethodtooperatetherecordsofresultset.
Afterfoundstheasthisresultcollectionobject,issimilarwiththeDAOobjectstorehouseuse,maythroughtransfermethodrealizationsandsoonitsAddnew,Update,Deletevisittoassignthedatapooleachkindofrequest.
3.ADOTechnology
ADO(ActiveXDataObjects)isthelatestdataaccesstechnologyofMicrosoft,ItusesdataaccessingconnectionUDA(UniversalDataAccess),tostandardalldatasasakindofdatapool,throughthefiltrationofOLEDBconnection,transformsasakindofgeneraldataformatinthesameway,enablestheapplicationproceduretovisitthiskindofdatas.OLEDBisanunderlyinglevelofthedataaccessingconnection,withitwemayvisitkindsofdatapools,includingtraditionalrelateddatabases,aswellaselectronicmailsystemandself-definitioncommercialobject.
3.1UseADOControls
Single-clicktheComponentscommandinthemenuoftheProject,select“MicrosoftADODataControlintheComponentsdialogbox6.0(OLEDB)”,wemayaddADOcontrolstotheboxofcontrols.
WesettheOLEDBProviderandassigneddatabasefilebysettingtheConnectionstringattributeofADO,andwesettheRecordSourceattributeasrecordsourcethatADOconnected.SimilartoDAOandRDO,withit,weareabletovisitallkindsofdatabasefastly.
3.2UseTheADOObjectStorehouse
SingleclicktheReferencesordersintheProjectmenu,select“MicrosoftActiveXDataObjects2.0Library”intheReferencesdialogbox,youmayaddADOobject.
Oldobjectmodels,likeDAOandRDO,arelooklikelevels,alowerdataobjectlikeRecordsetisthesub-objectofhigherlevelobjectslikeEnvironmentandtheQueried.ButADOisactuallydifferent,itdefinedagroupofplanetopobject,themostimportant
ADOobjectsareConnection,RecordsetandCommand.
TheConnectionobjectisusedtoestablishtheconnectionofapplicationprocedureandthedatapool.TheCommandobjectisusedindefiningaSQLsentence,amemoryprocessorothercommandsthatoperatesthedatas.Recordsetobjectpreservesrecordsetsafterexecutions.
Byusingalternativemeansoftherecordsetobject,wecanmodify,deleteandinquiretherecordset.
4Conclusions
VBprovidesmanymethodstoaccomplishtheoperationtothedatabase,inwhichDAOmainlyfinishthevisittoISAMdatabase,RDOprovidesconnectiontotheODBCdatapool,bothRDOandDAOhavedevelopedasmaturedtechnology.BeforeVB6.0,themaintechnologyisaboutdatabasevisit,however,theActiveDataObjects(ADO),asnewgenerationofdatabaseinterfacewhichispromotedbyMicrosoft,isdesignedtoworkwithnewdataaccessinglevelOLEDB,sothatitprovidesgeneraldataaccessing(UniversalDataAccess),itprovidesquitealotadvantagestotheprogrammers,includingeasyuse,thefamiliarcontactsurface,highvelocity,aswellasthelowermemory.Asaresultofabovereasons,ADOwillgraduallyreplaceotherdataaccessingconnections,andwillbecomesthefundamentalmodeoftheVBofvisitdatabase.
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等方法可实现对表的各种操作。
2.RDO技术
RDO是提供对关系型ODBC数据源访问的接口。
当需要访问其他数据库如SQLServer,Oracle时,特别是需要建立客户/服务器应用程序时,可使用远程数据控件RDC(RemoteDataControl)和远程数据对象RDO(RemoteDataControl)通过ODBC驱动程序来实现对数据库的访问。
使用ODBC访问某数据库时必须先安装相应的驱动程序,建立一个数据源,通过指定的数据源访问相应的数据库。
建立ODBC数据源是打开“控制面板”窗口,双击ODBC管理程序的图标,在打开的ODBC数据源管理器对话框中单击“Add”按钮创建数据源,并选择对应的数据库名。
2.1使用RDC控件
与DATA控件在使用上很类似,用DataSourceName属性指定控件绑定的数据源名,用SQL属性指定记录集,不同的是,在RDC控件的SQL属性中必须采用SQL语句指定。
在数据库浏览时也经常与DBGrid控件联合使用。
2.2使用RDO对象库
在使用RDO对象之前,应在Project菜单项中选择References,选中“MicrosoftRemoteDataObject2.0”后才可以使用。
使用RDO访问ODBC数据源的步骤是:
(1)设置一个RDO环境对象
(2)用OpenConnection方法打开一个ODBC数据源
(3)用OpenResultSet方法建立结果对象
(4)利用给定的方法,对结果集中的记录进行各种操作。
3.ADO技术
ADO(ActiveXDataObjects)是微软最新的数据访问技术,它采用通用数据访问接口UDA(UniversalDataAccess),将所有的数据规范为一种数据源,经过OLEDB接口的过滤,以相同的方式转换成一种通用的数据格式,使应用程
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 外文 文献 翻译