2024年5月24日发(作者:)
附录1 外文翻译
VB程序访问数据库的两种途径
VB是Microsoft公司开发的一种面向对象的编程语言。虽然VB不是数据库
管理系统软件,但由于他提供了功能强大的数据库访问支持,使用他可以快速开
发出数据库应用系统。由于他还具有简单易学、可视化编程等优点,得到了许多
数据库开发者的青睐。
开发数据库应用系统必须遵循特定的数据库访问接口,从而建立数据库连
接,打开数据库的数据表,访问数据记录等。VB程序访问数据库有两种途径:
(1)使用数据控件访问数据库
VB 6内置了Jet数据库引擎提供的数据访问功能。VB提供的"数据控件"封
装了常用的访问数据库所需的属性、方法和事件,是快速开发数据库应用系统的
得力助手。数据控件提供了快速处理各种格式数据库的能力,开发者不必了解数
据库的具体构造和复杂的编程接口就能方便有效地访问数据库中的数据,从而极
大地降低了数据库应用系统的开发难度,加快了开发周期。在使用数据控件访问
数据库时,一般只需设置数据控件的某些属性就可以了。
使用数据控件的基本技巧如下:
①设置数据控件的Data Name属性
Data Name属性指定了数据控件要连接的数据库名称。利用DataName属性,
可以返回或设置数据控件的数据源的名称和位置。数据库类型有DataName所指
向的文件或目录指定。
②设置数据控件的Record Source属性
Record Source属性指定了数据控件要连接的数据表名称,该数据表应是
Data Name所指定的数据库中的某个数据表。利用Record Source属性,可以指
定数据控件所要连接的数据记录来源。
③设置数据感知控件的Data Source属性
数据感知控件用来显示数据库中的数据,如文本框控件(TextBoxContr01)
就是一个数据感知控件。应将数据感知控件的Data Source属性设置为数据控件
的名称。这样一来,数据感知控件就可以显示数据库中的数据了。
④设置数据感知控件的Data Field属性
Data Field属性指定了数据感知控件要显示的字段,该字段应是数据控件
所指定的数据表中的字段。这样一来,数据感知控件就可以显示数据库中的数据
了。
(2)使用ADO访问数据库
使用数据控件访问数据库,编程较简单。尽管如此,对于开发一个大型的商
业化的数据库应用系统而言,往往只有在程序中使用ADO才能获得所需的性能。
ADO(ActiveX Data Object)是VB的最新数据访问接口。ADO是为Microsoft
公司最新和最强大的数据访问范例OLEDB而设计的,是一个便于使用的应用程序
层接口。OLEDB能够为任何数据源提供高性能的访问,这些数据源包括关系和非
关系数据库、电子邮件和文件系统、文本和自定义业务对象等。ADO在关键的
Internet方案中使用最少的网络流量,并且在前端和数据源之间使用最少的层
次,所有这些都是为了提供轻量、高性能的接口。
ADO完全在程序代码中运行,使程序开发者可以完全摆脱数据控件的束缚,
直接编写程序代码访问本地或远程数据库中的数据,并且使数据访问更快和效率
更高。
使用ADO的基本技巧如下:
①配置ODBC数据源。
②在程序引用ADO对象之前,将ADO函数库设置为引用项目。
③使用ADO对象模型中的7个主要对象:Connection对象、Command对象、
Record set对象、Fields对象、Parameters对象、Errors对象和Properties
对象。这些对象拥有能执行对数据操作的方法,以及表示数据的某些特性或控制
某些对象方法行为的属性。
附录2 外文参考文献
Two Kinds Paths Of VB Procedure Interview Database
VB is one kind of object-oriented programming language which Microsoft
Corporation develops. Although VB is not the database management system software,
but because he has provided the function formidable database visit support, uses him
to be possible fast to develop the database application system. Because he also has
simply is easy to study, merit and so on programming, obtained many databases
Developments favor.
The development database application system must follow the particular
database interview pick up a people, from but establish the database link, opening the
database of data form, interview data recorded. VB procedure interview database
contain two kinds of paths:
(1) The usage data controls an interview database
VB 6 insides placed the data interview function that Jet database engine provide.
VB offering of" the data controls a piece" sealed to pack the in common use interview
database need of belong to the sex, method with the affairs, is a fast development
database application system have to dint assistant. The data controlled an offering the
ability that dispatch every kind of format database, developer need not the concrete
structure of the understanding database pick up a people with the complicated plait
distance the data that can be convenient to visit the database inside availably, from but
lowered biggest the database apply the difficulty of development of the system,
quickly the period of development. When the usage data controls an interview
database, the general needs to establish the data controls piece of some belong to the
sex all right.
The usage data controls the basic technique of the piece as follows:
① establishes the Data Name data controls the piece belongs to the sex.
The Data Name belongs to the sex specified the data controls a database for
wanting to be copular name. Making use of the Data Name belongs to the sex, can
return or establishes the name that data control a piece data sources with the position.
Database type contain a document for pointing to or catalogues specify.
② establishes the Record Source data controls the piece belongs to the sex.
The Record Source belongs to the sex specified the data controls a data for
wanting to be copular watch name, the data's form should be the some piece of a
database for specifying inside according to the form. Making use of the Record
Source belongs to the sex, can specify the data control a data for want to be copular
record source.
③ Establishes the data feels Data Source that knowing and controlling the piece
belongs to the sex.
The data feels to know to control a data for using to show the database inside,
controlling such as text this frame piece (TextBoxContr01) be a piece according to
feels to know to control piece. Should feel the data to know to control a piece the Data
Source belongs to the sex establishes to control for the data the name of the piece. By
so doing, the data feels to know to control a piece can then data in the manifestation
database.
④ Establishes the data feels Data Field that knowing and controlling the piece
belongs to the sex.
The Delafield belongs to the sex specified the data feels to know to control a
word for wanting to show a data for, the word's segment should is data controlling
first piece specify word in the form segment. By so doing, the data feels to know to
control a piece can then data in the manifestation database.
(2) Usage ADO interview database
The usage data controls an interview database, plait distance than simple. For all
that, for develop a large and commercial database application system but speech,
usually only have to use in procedure the ADO then can acquire a function for
needing.
The ADO (ActiveXDataObject) is a VB latest data interview to connect. The
ADO is to is latest for the company of Microsoft to visit the example OLEDB with
the most mighty data but design of, is an easy to the applied procedure layer that use
to connect. The OLEDB can provide the interview of the high performance for any
data source, these dataset source includes the relation with relate to the database,
E-mail not with the document system, text this with from definition business objected.
It use the minimal network discharge in the ADO the project of Internet in key, and
fore carry to use the minimal level of structure with the data source, have these are all
for the sake of offering light measure, the high performance connects.
The ADO is complete to circulate in procedure code, can make the procedure
developer get away from completely the data to control a piece tie, the direct plait
writes the procedure code interview native or data in the long range database, and
make data interview been sooner is higher with the efficiency.
The basic technique of the usage ADO is as follows:
① installs the ODBC data source.
② Establisheseses ADO function base as before procedure quote from the object
of ADO adduction item.
③ usage ADO object model inside: The object of Connection, the object of
Command, the object of Record set, the object of Fields, the object of Parameters, the
object of Errors with the object of Properties. These objectless own they can carry out
the logarithms according to the method of the operation, and mean that some
characteristics or control some objects methods of the data belong to the sex
behaviorally.
发布者:admin,转转请注明出处:http://www.yc00.com/web/1716529176a2728190.html
评论列表(0条)