软件工程专业外文翻译--VB的数据库编程分析

时间:2022-05-26 19:46:37 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。
外文原文

ANALYSIS OF DATABASE PROGRAMMING IN VB

VB (Visual Basic) is a visualization programming environment that Microsoft Corporation promotes based on the Basic language.It is simple and easy to study.It has formidable function so that many computer amateurs really like it.A lot of application softwares all use VB as the software development platform.When we use VB to develop the application software,how to use the database and carry on the management of the database is concerned by all exploiters.VB has provided many tools and methods for database programming.What method is used to visit the database depends on users different demands,a simple analysis of the VB database programming is explained as followings.

1.DAO Technology



By using Microsoft companys Jet Database Engine (Jet database engine),DAO (Data Access Object) the technology mainly provides visit to ISAM (smooth index search method) type database,such as the realization of the visit to database like FoxPro,Access, Dbase.

1.1 Use Data Controls



Data controls are produced by using “Data” button in the toolbox.It has 3 basic attributes:Connect,Database Name and RecordSource.Connect attribute specifys the database type that data controls visit,the default database is the Access database.The value of the Database Name attribute is the database filename which contains the complete path.The Record Source attribute is the recordset that we visit,also can be tables or SQL sentences.If we will visit table stud of database file teacher mdb of TEMP folder under D plate,then Data controlss Connect attribute is null,and the Database Name attribute is D: \temp \ teacher mdb,the value of the Record Source attribute is stud.This can accomplish the binding between Data controls and database records. Through the methods of Data controls like Add new,Update,Delete, Move last,we can visit the database as every request.When we browse the content in database,Data controlls is used frequently with DBGrid,it provides data inquiry in grid way.

1.2 Use DAO Object Storehouse

The model of the DAO object storehouse is mainly using hierarchical structure, Dentine is the object in the topmost story,below it are two object sets,Errors and workspace, under the workspace object,is the Databases set.When the application


procedure quotes the DAO object storehouse,it produces only a Dentine object,and produces a default automatical working space object named workspace.When not mentioned,all database operations are all work in workspace(0),which is a default work area.But we must pay attention:The Jet engine will not starts automatically after VB has been loaded. Only when we choose References in the menu of Project can we select Microsoft DAO 3.5 Object Library to use.We create databases with the method “Create Database” in DAO,use CreateTable method to bulid tables,use the “Open Database to open the database ,use Open recordsetmethod to open recordset,use Add new,Update,Delete,Move first,Edit methods to realize each kind of operations about tables.

2.RDO Technology

RDO provides a connection to related ODBC data pool.When we need to visit other databases like SQL Server,Oracle,especially to establish the customer/server application procedure,we may use the long range data controls RDC (Remote Data Control) and long range data objects RDO (Remote Data Control) to realize the visit to the database through the ODBC driver.



By using ODBC to visit some database we must first install the corresponding drivers,like establish a data pool,through assigned data pool to visit corresponding database.To establish the ODBC data pool is open the window of “the control panel”, double-clicks the icon of ODBC executive program,single-click “Add” button to create the data pool of the opening ODBC data pool supervisor dialog box,and choose corresponding database.

2.1 Use RDC Controls



Similar to the use of DATA Controls, we use Data source name attributes to assign the data source name that controls bind,and we use SQL attributes to assign the recordset, The difference is that,we have to use the SQL sentences to assign the SQL attribute in RDC Controls . When we browse the database we may find it is used with DBGrid frequently.

2.2 Use RDO Object Storehouse



Before we use RDO object,we should choose References in the menu of Project, clickMicrosoft Remote Data Object 2.0,then we can continue.

The step we use RDO to visit the ODBC data pool is: (1) Set a RDO environment object.







(2) Open an ODBC data pool with the method of Open connection.


(3) Establish a result object with the method of Open Result set. (4) Use assigned method to operate the records of resultset.





After founds the as this result collection object,is similar with the DAO object storehouse use,may through transfer method realizations and so on its Add new,Update, Delete visit to assign the data pool each kind of request.

3.ADO Technology



ADO (ActiveX Data Objects) is the latest data access technology of Microsoft,It uses data accessing connection UDA (Universal Data Access),to standard all datas as a kind of data pool,through the filtration of OLEDB connection,transforms as a kind of general data format in the same way,enables the application procedure to visit this kind of datas.OLEDB is an underlying level of the data accessing connection,with it we may visit kinds of data pools,including traditional related databases,as well as electronic mail system and self-definition commercial object.

3.1 Use ADO Controls



Single-click the Components command in the menu of the Project,select Microsoft ADO Data Control in the Components dialog box 6.0 (OLE DB),we may add ADO controls to the box of controls.



We set the OLEDB Provider and assigned database file by setting the Connection string attribute of ADO,and we set the Record Source attribute as record source that ADO connected.Similar to DAO and RDO, with it, we are able to visit all kinds of database fastly.

3.2 Use The ADO Object Storehouse

Single click the References orders in the Project menu, select “Microsoft ActiveX Data Objects 2.0 Library” in the References dialog box, you may add ADO object.

Old object models, like DAO and RDO, are look like levels,a lower data object like Recordset is the sub-object of higher level objects like Environment and the Queried. But ADO is actually different, it defined a group of plane top object, the most important

ADO objects are Connection, Recordset and Command.

The Connection object is used to establish the connection of application procedure and the data pool.The Command object is used in defining a SQL sentence, a memory process or other commands that operates the datas.Recordset object preserves recordsets after executions.




本文来源:https://www.wddqw.com/doc/4bef6143f321dd36a32d7375a417866fb94ac099.html