




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Analysis of Database Programming in VBVB (Visual Basic) is Microsoft Corporation promotes based on the Basic language visualization programming environment, but by its simple easy to study, the function formidable time the general computer amateurs favor, many application software all use VB to take the software development platform. In uses VB to develop the application software in the process, how uses the database and carries on the management for the database is all exploiter issue of concern.VB was the database programming has provided very many tools and the way, actually selected what method to carry on the database the visit to rely on users different demand, the following on makes a simple analysis to the VB database programming way. 1.DAO technology Through Microsoft Jet Database Engine (Jet database engine), DAO (Data Access Object) the technology mainly provides visit to ISAM (smooth index search method) type database, like realization visit to database and so on FoxPro, Access, Dbase. 1.1 uses Data to control Data controls are uses in the toolbox “Data” the button to produce. Should control to have 3 basic attributes: Connect, Database Name and RecordSource.Connect attribute specified data controls the database type which must visit, the default is the Access database; The Database Name attribute value for contains the complete way the database filename; The Record Source attribute value for the record compendium which must visit, may be shows, but also SQL sentence. If visits under D plate TEMP folder teacher mdb in the database file table stud, then Data controls the Connect attribute for spatially, the Database Name attribute is “D: temp teacher mdb”, the Record Source attribute value is “stud”.Like this realized Data to control and between the database recording data binding, through transferred Data to control method realizations and so on the Add new, Update, Delete, Move last visit to the database each kind of request, when carried on the database content browsing, Data controlled also frequently to control the coordinate use with Degrade, provided the grid way the data inquiry. 1.2 uses the DAO object storehouse The DAO object storehouse model mainly uses the hierarchical structure, Dentine is the topmost story object, below has Errors and the workspace two object sets, under the workspace object is the Databases set. Quotes the DAO object storehouse when the application procedure, only can produce a Dentine object, and produces a default automatically working space object workspace, in other has not assigned in the situation, all database operation all is in workspace(0) carries out in the default work area, but must pay attention: The Jet engine starts after VB cannot load automatically, only then chooses References in the Project menu item, then selects Microsoft DAO 3.5 Object Library only then to be possible to use. uses the Create Database method foundation database in DAO, with the CreateTableDef method foundation table, opens the database with the Open Database method which assigns, opens the record compendium with the Open record set method, uses Add new, Update, Delete, Move first, Edit methods and so on record set object to be possible to realize for table each kind of operation. Through the DAO other method transfer, may realize to the table other operations. 1.RDO technology RDO is provides to relates the ODBC data pool visit connection. When needs to visit other database like SQL Server, Oracle, when specially needs to establish the customer/server application procedure, may use the long range data to control RDC (Remote Data Control) and long range data object RDO (Remote Data Control) realizes through the ODBC driver visit to the database. Uses ODBC visits when some database must first install the corresponding driver, establishes a data pool, through data pool visit corresponding database which assigns. Establishes the ODBC data pool is turns on “the control panel” the window, double-clicks the ODBC executive program the icon, in opens in the ODBC data pool supervisor dialog box single-clicks “Add” the button to found the data pool, and chooses corresponding database. 2.1 uses RDC to control Controls with DATA to be very similar in the use, assigns with the Data source name attribute to control a binding the data source name, assigns the record compendium with the SQL attribute, different is, controls in the SQL attribute in RDC to have to use the SQL sentence to assign. When database browsing also frequently controls the union use with DBGrid. 2.2 uses the RDO object storehouse In uses in front of the RDO object, should choose References in the Project menu item, after selects “Microsoft Remote Data Object 2.0” only then to be possible to use.uses RDO to visit the ODBC data pool the step is: (1) Establishes a RDO environment object. (2) Uses the Open connection method to open an ODBC data pool. (3) Uses the Open Result set method to establish the result collection object. (4) Use assigns the method, carries on each kind of operation to the result centralism recording. 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 Microsoft most recent data accessing technology, he uses general data accessing connection UDA (Universal Data Access), all data standard will be one kind of data pool, passes through OLE the DB connection filtration, transforms one kind of general data format by the same way, enables the application procedure to visit this kind of data.OLE DB is an underlying bed data accessing connection, may visit each kind of data pool with him, including traditional relations database, as well as electronic mail system and from definition commercial object. 3.1 uses ADO to control single-clicks the Components order in the Project menu, selects “Microsoft ADO Data Control in the Components dialog box 6.0 (OLE DB)”, may control ADO to increase to controls in a box. controls the Connection string attribute through ADO to establish the database file which OLE DB Provider and assigns, the Record Source attribute establishes ADO to control the connected record source. Are similar with DAO and RDO, controls through ADO with the recording source connection, may realize to each kind of database fast access. 3.2 uses the ADO object storehouseSingle-clicks the References order in the Project menu, selects “Microsoft ActiveX Data Objects 2.0 Library” in the References dialog box, may increase in the project to the ADO object storehouse quotation. Beforehand object model, like DAO and RDO all are the level, low data object like Record set is several high level object like Environment and the Queried sub-object. But ADO is actually different, he has defined a group of plane top object, the most important 3 ADO object is Connection, Record set and Command. The Connection object uses in establishing the application procedure and the data pool connection; The Command object uses in defining a SQL sentence, a memory process or other carries on the operation to the data the order; After the Record set object preservation execution order returns record compendium. Through transfers the Record set object the alternative means, may realize to operations and so on record compendium revision, deletion, inquiry. 4 conclusions VB provided the very many method realization to the database operation, in which DAO main realization visit to ISAM database, RDO has provided to the ODBC data pool connection, RDO and DAO all has developed for the quite mature technology, in VB in front of 6.0 is the main database visit technology, but Active Data Objects(ADO) the recent generation of database interface which promotes as Microsoft, is designed with recent data accessing level OLE DB the Provider together joint operation, provides the general data accessing (Universal Data Access), he has provided very many advantage to the VB programmer, including easy to use, the familiar contact surface, the high velocity as well as the low memory takes (Has realized ADO2.0 Msado15.dll to need to take the 342K memory, is slightly smaller than RDO Msrdo20.dll 368K, probably is DAO3.5 Dao350.dll occupies the memory 60%), as a result of above reason, ADO gradually will replace other data accessing connection, will become the VB visit database the fundamental mode.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方法打开记录集,使用record set对象的Add new,Update,Delete,Move first,Edit等方法可实现对表的各种操作。通过DAO其他的方法调用,可实现对表的其他操作。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 Result set方法建立结果对象 (4)利用给定的方法,对结果集中的记录进行各种操作。 创建rs这一结果集对象后,与DAO对象库的使用类似,就可通过调用其Add new Update Delete方法实现对指定数据源的各种访问要求。3. ADO技术 ADO(ActiveX Data Objects)是微软最新的数据访问技术,他采用通用数据访问接口UDA(Universal Data Access),将所有的数据规范为一种数据源,经过OLE DB接口的过滤,以相同的方式转换成一种通用的数据格式,使应用程序能访问这种数据。OLE DB是一个低层的数据访问接口,用他可以访问各种数据源,包括传统的关系型数据库,以及电子邮件系统及自定义的商业对象。3.1使用ADO控件 在Project菜单中单击Components命令,在Components对话框中选中“Microsoft ADO Data Control 6.0(OLE DB)”,可将ADO控件添加到控件箱中。 通过ADO控件的Connection string属性设置OLE DB 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)作为微软推出的新一代数据库接口,被设计同新的数据访问层OLE DB Provider一起协同工作,以提供通用数据访问(Universal DataAccess),他向VB程序员提供了很多好处,包括易于使用,熟悉的界面,高速度以及较低的内存占用(已实现ADO2.0的Msado15.dll需要占用342K内存,比RDO的Msrdo20.dll的368K略小,大约是DAO3.5的Dao350.dll所占内存的60),由于以上原因,ADO将逐渐代替其他数据访问接口,成为VB访问数据库的主要方式。Database development and applicationAlong with social development, human production and daily life increasingly inseparable from the information. Whoever has more effective information will then be in a stronger competitive position. The information industry is becoming the backbone of a country. Data as an information carrier, its database management tool for the importance of information technology, is gaining increasing attention. Only those with advanced database technology to effectively manage a broad array of data, and extract themselves from useful information to be used.From the late 1960s, the database system has been after 30 years of history, we have two generations of evolution. First-generation database system is level with the network database system. Second-generation database system is relational database system. 30, people mainly second-generation database system to the theoretical research and system development and made great achievements. Improve relations marked the establishment of the theory of relational database theory and tend to improve. Commercialization of DB2, INGRES, ORACLS.SYBASE, relational databases such as SQL SERVER marks the emergence of relational database system has been close to capacity. First - and second-generation database system design objectives from commercial transaction processing. Over the years, these two generations of database system is mainly used for banking, the aircraft will deal with matters such as votes. From the 1980s to the present, people have been exploring the next generation of database systems theories, technologies and methods.The constant updating of computer hardware, and doubling their performance, and communication technology and computer network technology in the rapid development of a common database for a leap in technology to produce a revolutionary application of the change. Relational databases, object databases and objects - such as relational database technology, so that data has been deposited into the problem has been the better solution. How to find a better approach would be for users relevant types of data through the Internet / Intranet, from the global scope of the database is extracted, this is of great significance to users of the problem has become information taxonomy (Information systematic IS) The main direction. Global major database vendors (Informix, IBM, Oracle, Sybase, Microsoft, etc.) To resolve this problem, has made a number of related technologies, by emphasizing Internet connectivity to help users extract and effective use of data.The data warehouse data, data mart, data mining techniques is considerably advanced database management system development.1. Data warehouse data: Data Warehouse tend to a logical concept, it developed in a number of databases on these databases can be physically separated, or even belonging to different countries. Data warehouse via the Internet to break geographical boundaries, they will be a synthesis of the overall logic, a massive database to the user before the show. Data Warehouse as a service to enterprise-level applications, generally speaking provides users with the advantages of the following four aspects:a. Reduce the burden of system to simplify day-to-day maintenance and managementb. Improving data integrity, compatibility and effectivenessc. Improve the efficiency of data accessd. Provides simple, the unified inquiry and the report form mechanism2. Data rural fairs: The data warehouse took the enterprise application, it involves the scope and the investment cost is frequently huge, its construction is very easy to form the high investment, the slow progress big project. All these are the department/work teams did not hope saw and cannot accept. The department/work teams request in the company interior to obtain one kind to suit own application easily, to use, also voluntarily directional, convenience highly effective open style data connection tool. Compares with the data warehouse, this kind of tool should a closer integration, have the integrity graphical user interface and a more appealing price. Is precisely department/work teams this kind of demand causes the data rural fair to arise at the historic moment. The data rural fair describes the brief summary is: The data rural fair is one kind smaller, the more centralized data warehouse, it has provided a department/work team level analysis commercial data inexpensive way for the company. The data rural fair should have the characteristic includes: The scale small, face the specific application, face the department/work teams, the fast realization, the investment scale small, easy to use, to support the heterogeneous machine platform comprehensively and so on. The user may act according to own demand, establishes the data rural fair by own way. No matter is by from the top downward, from bottom to top way establishment data rural fair, guaranteed most importantly the data rural fair can converse mutually, each other cannot communicate the data rural fair is useless. Moreover, permits the people after the WWW visit data rural fair, causes it to provide the data accessing for more users, also is the essential function.3. Data minings: The data mining is from the database or the data warehouse discovered and withdraws hides in the among information one kind of new technology. It establishes in the database, above the data warehouse foundation, faces the non-specialized user, locates in particular in the tabletop, and supports the extemporaneously stochastic inquiry. The data mining technology can the automated analysis data, carry on the induction inference and the association to them, seeks the data the intrinsic certain connections, excavates latent, to the information forecast and the policy-making behavior is playing the extremely vital role pattern, thus establish
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《中老年健康评估与干预策略》课件
- 《绿源电动车品牌代理全案》课件
- 广东省广州市越秀区2020-2021学年七年级下学期期末考试语文试题(含答案)
- 《GBT43880.3-2024服务型制造导则第3部分:资源管理》(2025版)深度解析
- 《GBT42422-2023金融机构风险管理框架》(2025版)深度解析
- 《绩效激励机制》课件
- 《动态过渡效果》课件
- 高效的审计学习方法与试题及答案专家建议
- 《肺部疾病病理学》课件
- 大班美术活动说课
- 汽车合伙合同协议书
- 2024年宝鸡市城投资产管理有限公司招聘笔试真题
- 2025夏季安徽蚌埠市东方人力资源有限劳务派遣人员招聘30人笔试参考题库附带答案详解
- 2025企业主要负责人安全培训考试试题及答案典型题
- 机械样机摆放协议书
- 地毯维修工程合同协议
- 2025年嘉兴市九年级中考语文一模试卷附答案解析
- 2025年安徽数学中考第2题:科学计数法【含答案】
- 荒料购销合同协议
- 2024年榆林市社区专职工作人员招聘考试真题
- 双重预防机制管理制度
评论
0/150
提交评论