




已阅读5页,还剩9页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
ANALYSIS OF DATABASE PROGRAMMING IN VBVB (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 recordset”method 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, click”Microsoft 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 StorehouseSingle 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. By using alternative means of the recordset object, we can modify,delete and inquire the recordset. 4 Conclusions VB provides many methods to accomplish the operation to the database, in which DAO mainly finish the visit to ISAM database, RDO provides connection to the ODBC data pool, both RDO and DAO have developed as matured technology.Before VB 6.0 ,the main technology is about database visit, however,the Active Data Objects(ADO) ,as new generation of database interface which is promoted by Microsoft, is designed to work with new data accessing level OLEDB, so that it provides general data accessing (Universal Data Access), it provides quite a lot advantages to the programmers, including easy use, the familiar contact surface, high velocity ,as well as the lower memory. As a result of above reasons, ADO will gradually replace other data accessing connections, and will becomes the fundamental mode of the VB of visit database.VB的数据库编程分析VB(Visual Basic)是微软公司推出的基于Basic语言的可视化编程环境,以其简单易学、功能强大而倍受广大电脑爱好者的青睐。很多应用软件都采用VB作为软件开发平台。在用VB开发应用软件的过程中,如何使用数据库并对数据库进行管理是所有开发者关心的问题。VB为数据库的编程提供了很多的工具和方式,究竟采用何种方式进行数据库的访问依赖于用户的不同需求,以下就对VB的数据库编程方式做一个简单剖析。1.DAO技术 通过Microsoft的Jet Database Engine(Jet 数据库引擎),DAO(Data Access Object)技术主要提供对ISAM(顺序索引查找方法)类型数据库的访问,如实现对FoxPro,Access,Dbase等数据库的访问。 1.1使用Data控件 Data控件是利用工具箱中的“Data”按钮产生的。该控件有3个基本属性:Connect,Database Name和Record Source。其中Connect属性确定数据控件要访问的数据库类型,默认为Access数据库,Database Name属性的值为包含完整路径的数据库文件名,Record Source属性值为要访问的记录集,可以是表,也可是SQL语句。如访问D盘TEMP文件夹下的teachermdb数据库文件中的表stud,则Data控件的Connect属性为空,Database Name属性为“D:tempteachermdb”,Record Source属性值为“stud”。这样就实现了Data控件和数据库记录之间的数据绑定,通过调用Data控件的Add new,Update,Delete,Move last等方法实现对数据库的各种访问要求,在进行数据库内容浏览时,Data控件还经常和DBGrid控件配合使用,提供网格方式的数据查询。 1.2利用DAO对象库 DAO对象库的模型主要采用层次结构,Dentine是最高层的对象,下面有Errors和workspace两个对象集合,在workspace对象下是Databases集合。在应用程序引用DAO对象库时,只会产生一个Dbengine对象,并自动生成一个默认的工作空间对象workspace,在没有另外指定的情况下,所有的数据库操作都是在默认工作区workspace(0)中执行的,但要注意:Jet引擎在VB启动后不会自动装入,只有在Project菜单项中选择References,然后选中Microsoft DAO 3.5 Object Library才可以使用。 在DAO中使用Create Database方法创建数据库,用Create Table 方法创建表,用Open Database方法打开指定的数据库,用Open record set方法打开记录集,使用recordset对象的Add new,Update,Delete,Move first,Edit等方法可实现对表的各种操作。2. RDO技术 RDO是提供对关系型ODBC数据源访问的接口。当需要访问其他数据库如SQL Server,Oracle时,特别是需要建立客户/服务器应用程序时,可使用远程数据控件RDC(Remote Data Control)和远程数据对象RDO(Remote Data Control)通过ODBC驱动程序来实现对数据库的访问。 使用ODBC访问某数据库时必须先安装相应的驱动程序,建立一个数据源,通过指定的数据源访问相应的数据库。建立ODBC数据源是打开“控制面板”窗口,双击ODBC管理程序的图标,在打开的ODBC数据源管理器对话框中单击“Add”按钮创建数据源,并选择对应的数据库名。 2.1使用RDC控件 与DATA控件在使用上很类似,用Data Source Name属性指定控件绑定的数据源名,用SQL属性指定记录集,不同的是,在RDC控件的SQL属性中必须采用SQL语句指定。在数据库浏览时也经常与DBGrid控件联合使用。 2.2使用RDO对象库 在使用RDO对象之前,应在Project菜单项中选择References,选中“Microsoft Remote Data Object 2.0”后才可以使用。 使用RDO访问ODBC数据源的步骤是: (1)设置一个RDO环境对象 (2)用Open Connection方法打开一个ODBC数据源 (3)用Open ResultSet方法建立结果对象 (4)利用给定的方法,对结果集中的记录进行各种操作。3. ADO技术 ADO(ActiveX Data Objects)是微软最新的数据访问技术,它采用通用数据访问接口UDA(Universal Data Access),将所有的数据规范为一种数据源,经过OLEDB接口的过滤,以相同的方式转换成一种通用的数据格式,使应用程序能访问这种数据。OLEDB是一个低层的数据访问接口,用它可以访问各种数据源,包括传统的关系型数据库,以及电子邮件系统及自定义的商业对象。 3.1使用ADO控件 在Project菜单中单击Components命令,在Components对话框中选中“Microsoft ADO Data Control 6.0(OLEDB)”,可将ADO控件添加到控件箱中。 通过ADO控件的Connection string属性设置OLEDB Provider和指定的数据库文件,Record Source属性设置ADO控件相连的记录源。与DAO和RDO类似,通过ADO控件与记录源的连接,可实现对各种数据库的快速访问。 3.2使用ADO对象库 在Project菜单中单击References命令,在References对话框中选中“Microsoft ActiveX Data Objects 2.0 Library”,可在工程中添加对ADO对象库的引用。 以前的对象模型,如DAO和RDO都是层次型的,一个较低的数据对象如Record set是几个较高层次的对象如Environment和Queried的子对象。但ADO却不同,它定义了一组平面型顶级对象,最重要的3个ADO对象是Connection, Record set和Command。 Connection对象用于建立应用程序和数据源的连接;Command对象用于定义一个SQL语句、一个存储过程或其他对数据进行操作的命令,Record set对象保存执行命令后返回的记录集。 通过调用Record set对象的其他方法,可实现对记录集的修改、删除、查询等操作。4. 结语VB提供了很多方法实现对数据库的操作,其中DAO主要实现对ISAM数据库的访问,RDO提供对ODBC数据源的接口,RDO 和DAO 都已发展为相当成熟的技术。在VB 6.0之前是主要的数据库访问技术,而Active Data Objects(ADO)作为微软推出的新一代数据库接口,被设计同新的数据访问层OLEDB Provider一起协同工作,以提供通用数据访问(Universal DataAccess),它向VB程序员提供了很多好处,包括易于使用,熟悉的界面,高速度以及较低的内存占用。由于以上原因,ADO将逐渐代替其他数据访问接口,成为VB访问数据库的主要方式。THE DEVELOPMENT 、APPLICATIONS AND BASIC PRINCIPLES OF DATABASEAlong with the social development,humans production and daily life is increasingly inseparable from the information.Whoever has more effective information will be in a stronger competitive position.The information industry is becoming the backbone of a country.Data,as an information carrier,is gaining increasing attention by people because of its importance of its management tool database to the information technology.Only we own advanced database technology can we manage a array of data effectively,and extract useful information to use.From the late 1960s,the database system has been developed during 30 years,two generations of evolution.The first-generation database system is level with the network database system.The second-generation database system is related database system.During 30 years,people mainly devoted themselves to theoretical research and system development of the second-generation database system and gained great achievements. Improving related theory establishment marked the improve of the related database system theory.Commercialization of DB2,INGRES,ORACLS,SYBASE,relational databases such as SQL SERVER marked that the emergence of relational database system has been reached to top.The first and second-generation database system are designed from commercial transaction processing.Over these years,these two generations of database system is mainly used for banking,the aircraft booking tickets and so on.From the 1980s, We are always exploring the theories, technologies and methods of next generation of database systems.The constant updating of computer hardware,the doubling of their performance,and the communication technology and computer network technologys rapid development are promoting a big step of the technology of database,and make a revolutionary change of its applications.The appearance of the technology of Relational databases,object databases and objects-relation database has solved the problem of data deposition better.How to find a better approach which is used for extraction the relevant types of data that users wanted , from the global-scope databases through the Internet / Intranet, this has becomed the main research diretion of information taxonomy (Information systematic IS) which is significant to users.The global major database vendors (Informix,IBM,Oracle,Sybase,Microsoft,etc.) , in order to solve this problem, has picked up some related technologies,by emphasizing the connectivity of Internet, they help users extract and use datas.Among them,the data in warehouse,data market,data mining techniques are considerably advanced the development of database management system.1. Data In WarehouseData Warehouse is a concept which tends to a logical concept, it is created based on a number of databases,these databases can be separated in physical, or even belonging to different countries.Data warehouse break geographical boundaries via the Internet, which union them as a logic synthesis and show the usesr massive databases. Data Warehouse,as a service to enterprise-level application,generally speaking,it provides users with four aspects advantages as followings:a. Reduce the burden of the system and simplify day-to-day maintenance and managementb. Improve the data integrity, compatibility and effectivenessc. Improve the efficiency of data accessd. Provide simple, unified inquiry and the report form mechanism2. Data Rural FairsThe data warehouse,as an enterprise application,it often involves wide scopes and huge investment costs, its construction usually forms as a big project with high investment and slow progress.The department/work teams are not willing to see and accept this.The department/work teams are prefer to acquire open-style data connection tool which fits to own application,easy to use,voluntarily directional,convenient and effective in the company.Compared with the data warehouse,this kind of tool has a closer integration, graphical user interface and more appealing prices.That it is the department/work teams demands make the data rural fair arise in the historic moment.The data rural fair can be described briefly as:smaller,more centralized.it provided a cheaper way for department/work team to analysis commercial data of the company.The data rural fair should own the characteristics includes:small scale,face the specific application,face the department/work teams,fast realization,small scale investment,easy to use,support the heterogeneous machine platform comprehensively and so on.Users may bulid their the data rural fair according to their demands,with their motheds.No matter from the top to downward or from bottom to top,the most important is to guarantee the dialog between data rural fairs, the data rural fair without mutual communication is useless.Moreover, it permits people visit data rural fair via WWW,allows it to provide the data accessing for more users, and this is also essential.3. Data MiningThe data mining is a kind of new technology which discovers and picks up the hiding data from the database or the data warehouse.It is established on the database,especially on the data warehouse.It also faces the non-specialized users and locates itself in the tabletop,and supports the extemporaneously stochastic inquiry.The data mining technologies can automatically analysis data,detect and reason them with imagination.It seeks the certain intrinsic connections between data,to excavate the latent, extremely vital patterns which influence the information forecast and the policy-making behavior.It establishes a new service model so that helps the policy-makers to formulate the market strategy and correct policy-making goal.The data mining technology involves the database, the artificial intelligence (Artificial intelligence, AI),the machine learning,the nerve computation and the statistical analysis and so on.It makes the policy-making support tool (Decision Supporting System,DSS) step into a new stage.What about the basic principles of database?4. Information, Data And Data ProcessingWe live in an information world,the information is the direct description by people to the objective world.It will produce massive information when people take part in the activities like politics,the economy,the military,the culture,the education,the science,the art and so on.The information needs to be processed and to be exchanged and to be used. Along with the rapid development of computer technology, the computer has characteristics like high speed handling and huge storage capacity,which enables the people possiblely preserve and process massive information.In order to record the information,people have used various physical marks and their combinations to express the information,these marks and the combinations are the data.The data is the manifestation of information,the information is the ignificance performance of data.However,data that collected by people will
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 员工离岗测试题及答案
- 2025年国家电梯作业人员T证考试练习题库(含答案)
- 静脉输液考试测试卷附答案
- 2024年下半年全国事业单位联考A类《综合应用能力》真题(附答案)
- 北京特产工艺品知识培训课件
- 消毒消毒考试题及答案
- 电工(初级工)模拟练习题与参考答案
- 2024年度河南安全生产月知识考试试题附参考答案
- 2024年第六届全国安全生产知识竞赛题库与答案
- 标准日本语阅读课件
- BB/T 0023-2017纸护角
- 建设集团有限公司安全生产管理制度汇编
- 行为习惯养成教育校本教材
- 疫苗运输温度记录表
- 各国钢材-合金牌号对照表
- 医院定岗定编要点
- logopress3培训视频教程整套模具大纲
- DB32-T 2945-2016硬质合金刀具PVD涂层测试方法-(高清现行)
- TB∕T 3526-2018 机车车辆电气设备 接触器
- 发电厂项目施工技术标—热控专业施工方案
- 1331等腰三角形的性质课件
评论
0/150
提交评论