ImageVerifierCode 换一换
格式:DOC , 页数:13 ,大小:36.50KB ,
资源ID:2790807      下载积分:20 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-2790807.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(VB创建ACCESS数据库全解(VB creates ACCESS database full solution).doc)为本站会员(dzzj200808)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

VB创建ACCESS数据库全解(VB creates ACCESS database full solution).doc

1、VB创建 ACCESS数据库全解(VB creates ACCESS database full solution)This article is contributed by achm207VB ACCESS database to create solutions to create the database, dynamically create table, create a record, ADO ADOX2010-01-22 13:28 Abstract: This paper describes the VB program using ADO dynamic method to

2、 create database and data table, these methods have practical value in developing VB database application, it can improve the flexibility of database program.Keywords: database, data table, ADO, ADOXThe 1: question is proposedIn Visual Basic, data access interface commonly used are the following thr

3、ee: database access object (DAO Data, Access Object), the remote database objects (RDO, Remote Data Object) and ActiveX (ADO, ActiveX, Data data object Object). Database access technology has been improving, and each of these three interfaces represents the different stages of the development of the

4、 technology. The latest is ADO, a simpler, more flexible object model than RDO and DAO. Because of this, more and more people use ADO as the data access interface when developing database software with VB. In the development process, we usually use the method is to use the database management system

5、 (e.g. Microsoft Access) or VisData in VB to establish a database and data table structure, and then through the use of ADODC database control or reference to the ADO object to establish a connection with the database table in the program, and then through the database controls (e.g., text boxes, Da

6、taGrid etc.) to carry out various operations of the database. In this development process, we sometimes have to face the question of how to allow users to dynamically build their own databases and data tables in order to improve the flexibility of the program In the process of running the establishm

7、ent of their own required database and data table, its essence is to use code (or through programming) to build databases and data tables. As you all know, this is an easy event in Foxpro or ASP programming. So, in the VB database programming, and how to operate it? The VB database programming, if y

8、ou use DAO as database access interface technology, can be achieved by CreateDatabase combined with CreateTableDef method, there are many books and magazines about this way, this is no longer about; but if you are using the latest technology of ADO database access interface, you can find the book an

9、d no magazine article that how to use the code to create database and data table, sometimes we can be very necessary to use this method, here we have to solve this problem.2:, ADO, and ADOXLets take a brief look at ADO and ADOX. In VB6, the use of ADO database application development, we should refe

10、r to “Microsoft ActiveX Data Objects object library 2.5 Library“, it is referred to as ADO, it is the core of the VB6 database and VB database object groups, developers often referred to as VB6 in the library, you can see various versions it, from version 2 to version 2.6 there are a lot of people a

11、re familiar with it, then we are no longer in detail. To create databases and tables during the run of the program, we also refer to the object library “Microsoft ADO Ext 2.1. DDL Security“, referred to as “ADOX“, and its library name is “Msadox.dll“: For. ADOX is an extension of the ADO object and

12、programming model that extends ADO to include creation, modification, and deletion of schema objects such as tables and processes. It also includes security objects for maintaining users and groups, and granting and revoking privileges to objects. The object of ADOX is shown in the following table:O

13、bject specificationCatalog contains a collection that describes the schema of the data source schema.Column represents columns of tables, indexes, or keywords.Group represents the group account with access rights in the secure database.Index represents the index in the database table.Key represents

14、the primary key, external keyword, or unique keyword in the database table.Procedure represents the stored procedure.Table represents a database table, including columns, indexes, and keywords.User represents the user account with access rights within the secure database.View represents the filtered

15、 set of records or virtual tables.ADOX commonly used methods are: Append (including Columns, Groups, Indexes, Keys, Procedures, Tables, Users, Views (Create), create a new directory (Delete), delete the object in the collection (Refresh), update the objects in the collection and so on). For more inf

16、ormation about ADOX, see the Web page on ADOX for Microsoft published in http:/ generates new data tables based on the existing data tablesIf only new data tables are generated on the basis of existing data tables, we simply refer to the object library “Microsoft, ActiveX, Data, Objects, 2.5, Librar

17、y“ and then use Select. The Into statement is fine. For example: a database named Wage.mdb, the database has a “payroll data sheet, the field data table: number, name, salary, allowances, deductions, wages, real wages, there have been many records in the table. Now we have the real wages of more tha

18、n 2000 records were screened out to form a new table, the name of the new table input by the user from the text box, the new table we as long as three fields, they are: number, name, real wages. We can do it with the following procedures:Add a text box Text1 and a command button Command1 in the form

19、 beforehandDim, Conn, As, New, ADODB.ConnectionDim, RS, As, New, ADODB.RecordsetDim, command, As, New, ADODB.commandPrivate, Sub, Command1_Click ()Dim BM As StringDim SQL As StringIf Text1.Text “Then“BM = Trim (Text1.Text)Sql= “Select number, name, real wage Into“ + BM + From salary Where, 2000 sala

20、ry“Set command.ActiveConnection = connCommand.CommandText = SQLCommand.ExecuteElseMsgBox “you must enter a name.“End IfPrivate, Sub, Form_Load ()Dim str As StringSTR = App.PathIf Right (STR, 1) “ Then “STR = STR + “End IfPSTR = “Provider=Microsoft.Jet.OLEDB.3.51“;“PSTR = PSTR “PSTR = PSTR “cant chan

21、ge“ 4 “here to“ 3.51 “PSTR = PSTR in VB6, the 3.51 version of the Microsoft Jet OLEDB driver corresponds to the Access97 database. In other words, built by this method with the database and table with the Access2000 database and table are of the same type, you can directly use the Access2000 to open

22、, although you can use VB6 to access the database and the data table, but you cannot use Access97 or VB6 in the “visual data manager to directly open.When the program is running, as long as the user clicks the command button, you can create your own database. The code corresponding to the view comma

23、nd button is:Private, Sub, Command3_Click ()Set DataGrid1.DataSource = RSEnd SubThe code corresponding to the update command button is:Private, Sub, Command4_Click ()Rs.UpdateBatchEnd SubThis example is used to illustrate the problem in practical application, you can take it further improvement, for

24、 example: you in the form to add some text box and combo box for the user to enter or select the data table name, field names, field width and the number of decimal places. In this way, the user can determine all the contents of the database autonomously, and the flexibility of the program will be g

25、reatly improved.5: conclusionIf you are using the latest data access interface technology ADO (Microsoft strongly recommends that you use the latest technology), you want to create a database file in the program and data table, at this point, you should be in the Visual Basic 6 object reference libr

26、ary “Microsoft ActiveX Data Objects 2.5 Library“ and “Microsoft ADO Ext 2.1. For DDL Security, Create, Append and other methods and then use the ADOX object can be achieved. The version of the Microsoft Jet OLEDB driver used by this method is 4, so the database files and data tables built using this method can be opened directly using Access2000. The author has used this method many times during the development of VB database software. This method has a great effect on improving the flexibility of programs and satisfying the special needs of users.

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报