版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.To connect SQL Server databaseFirst we introduce the basic knowledge of the database,be regarded as the warm-up exercise that study database weave distance front!1.warm-up exerciseNeeding first avowal is relation database that database knowledge that we here introduce all point. The so -called rela
2、tion database is to mean data as that the form gather, passing to establish simple form an a kind of database for of relation to defining construction.I ignore the watch at how saving way in physics in the document in database is,it can see to make an a line for with row, with electronics form is si
3、milar with the row.In relation database, the line were called the record, but the row then is called word segment.This form inside each an all in formations for is a record, it including particular customer, but each record then included the same type with the word segment of the quantity:Customers
4、number, name etc.Form is logic set that a kind of related information that press a line of arranging with row, similar in single form in work.Each row of the word a database form inside calls a word segment. Watch is from every kind of word a definition of its containment of, each word a data for de
5、scribing its implying. While creating to set up a database, the beard assign for each word segment a the piece belongs to the sex with the other according to the type,biggest length.The word segment can include every kind of word sign,arithmetic figure even sketch.An information of relevant customer
6、 deposits in the line of the form, is called record.By any large, arbitrarily two records for database form to create set up cant be same.Key be a certain word segment( or several words segment) of the form inside, it() for fast inspect but drive index. The key can be unique, and also can then the r
7、ight and wrong is unique, being decided by it() whether admission repetition. Unique key can specify for main key, using each one that come to unique marking form.The norm turns the database design of mission be method that the data of buildup,but the data of buildup, should can dissolve otiose repe
8、tition, and for have the necessary information offering to check to seek the path quickly. For attaining this kind of target but separate information to the process gone to in every kind of independent form, be called the norm turn.It is complicated process to use many appointed rules to proceed the
9、 norm with the type of the different Class that norm turn. That process studies and discuss already beyond the reach of textual scope.But,the norm of the simple database in majority turn and can use the simple experience in underneath rule completes: include the form of the information of repetition
10、 must be divided into independent a few forms dissolve repetition.If we have chosen to learn 12 curricular 1000 students, the each curricular elucidation will show with the teacher 100 many- to choose that curricular and.eachstudent repeat once.To avoid this kind of low efficiency, should to turn th
11、e dichotomous and independent form in form to the norm,an is used to mean the student,the another uses mean the course.Now the form was turned by the norm, so, to changes the particular and curricular course describe or data,as long as change a record all right.Is a basic knowledge concerning databa
12、se above,this is what study database plait distance must.Although the database technique is used as a course,its depth is not this space and can describe with the wide degree of,be used as the primer with simple database plait the distance should be all right already.Like,underneath we can start pra
13、cticing.We usually meet the database system is to registers the system,ignoring you are in the unit,or attend what buildup,the register is to cans not help of,and it of the construction is more simple,we take a register system as an example.The analysis is once a data for involving.2. understanding
14、the elementsFor the register, want the on the trail of information include:name、sex、native place、age、 date of birth 、 unit 、address、 postal service codes、telephone、FAX. Certainly,can create to set up a form in brief,make above each piece according to item to should a word segment.Need to point the f
15、orm the main key in parties now, in order to unique marking each a record,increase register number conduct and actions unique key respectively in register form,guarantee a two records like this all different.To the database after making an above analysis,we can start establishing the database.3.set
16、up the firm in campHere we study to establish the database how,needing to make sure the type that to establish the database first.Pass in Visual Basic the data interview control piece or data interview object ( DAO) can visit the following database:1)The database of JET, namely Microsoft Access2)The
17、 database of ISAM, such as: DBase, etc. of FoxPro3)The database of ODBC,everyfollow the standard of ODBCcustomer/ server database. Such as: Microsoft SQL Server, OracleBy any large, if develop the personal small scaled database system, use Access database comparison accommodation, to develop the big
18、 and medium -sized database system uses the database of ODBC fester. But dBase with the database of FoxPro because of already dated,unless special circumstance,do not use otherwise.In our example, chose to use the database of Access certainly. Establish the database of Access contain two kinds of me
19、thods: While establishing the database in Microsoft Access. Click new set up button can establish the new form. Here we main introduction the second method: The usage can see to turn the data management machine, do not need to weave the distance and then can create to set up the database.Can see to
20、turn the data management machine is the applied procedure of a great use,it is a VB business enterprise version is supplementary with the profession version, in the catalogue. Devastation vb samples the Visdata is next, its interface is as follows the diagram.Click the menu document item is next new
21、 set up son item Microsoft ACCESS son item of edition 7.0 MDB item. Input the.new setting up the name of the database in flick window way open register, appear the underneath show the window way:Want the born and new form, the single shot in right key database window way flicks the menu open, then t
22、he choice new form ordinaries,establishing in watch construction dialog box appeared later on a word for wanting segment. The every time faces to join in the form new word segment, single shot increment word segment button, will appear of increment word segment dialog box.Increment word a type for o
23、ptions in the dialog box, according to word segment.In our the register database that establish, the type of the each word segment.Want to notice of is, because the word segment registers the number be used unique marking record of, therefore, it cant be inputted by customer. So while defining the w
24、ords segment need to be defined for Long data type, the automatic born word segment item is valid, and picks out this item. Be the customer like this to input to record with other the different value every input a new record, system would on the words segment automatically.In ACCESSdatabase, the key
25、 word realizes with the index of, conduct and actions plait distance personnel at gather to weave the distance to the record of the form type,needs to adjust to use index.While searching,the technique of Rushmore uses the index information the excellent turning the search automatically. Aftercomplet
26、ing the form definition, click increment index button, flick such aspen figure 5 show the window way.In window way the right side contain three optioned, its meaning, such as table,12.Increase the index dialog box options.After completing such as figure 6.Certainly, the academic association database
27、 establishes too not a dynasty the business of the one night, the reader no harm much practices once.Visit databases design and the development of the application procedures of MS Visual Basics of the databases of the SQL Server. When design a system, the customer still needs to comprehend to use to
28、 come to visit the plait distance of ask the data of SQL Server to connect. The origin was detailed to elaborate that the usage open type database conjunction (the Open Database Connectivity, ODBC) adjusts to connect the objects to connect with the class, still having the data interviews object (the
29、 Data Access Objects, the DAO) and the long-range data objects.Design and weave to write large and complicated and applied procedures database design for the software developer is a challenge, need to choose to weave the distance language and tools, do an accommodation for the SQL Server, choose the
30、 calculate way and the data structures, still need to design the sketch customer interface and the application procedures to connect. The decision within the most important software design is applied fixed position of the procedure. In other words, design must specify the system of which parts are d
31、ata, business rule, and the data entrance procedure and used for circulating the code of other part. The MS Visual Basic supports the plait distance that some databases manage the systems connect, especially SQL Server. Adjust to connect to include the ODBC and DB-Libraries to connect the, object to
32、 connect to include the data interview object (DAO), long range data object (the RDO), the OLE DB and the ActiveX Data Objects (ADO) with the class, the SQLthat returns the capable SQL Server to manage the mission distributes to.manage the object (the SQL Distributed management Objects, SQL-DMO) to
33、connect. Connect the oculars right choice can improve the whole function of system and the development speed biggest. Design the large data warehouse system needs to choose the applied model properly. Traditional customer/ services model depends on to join in the center layer but get the improvement
34、 to become three layer models. These three layers divide the line system as three parts: each layer is responsible for providing the service:(1) Data service( the Data Service) contain the maintenance data and the operation date such as the increment, modification, deletion and backups.These service
35、s maintenance data relation and contact,support backup andinstaurationoperation.Usually the data service is managed the system usage by the database.(2) business service( the Business Service) is handled the logic by the business rule and data to constitute, such as the data legitimacy rule, the bus
36、iness processing support and the record backup logics. The main purpose of these services provides the data maintenance toward the application procedure Logic.(3) expression service( the Presentation Service)( or the customer service)support customer interface, control the customer data to input to
37、express with data.(Output) Notice in customer/ services technical term, sometimes express the service definition as customers machine (or head), the data service definition for server (or after carry), but the business service is in the center the layer (the middle layer). But important comprehend a
38、ny two layers .The data service business service expresses the logic support GUI that the service maintenance database business rule and the processing data need, data importation and manifestation the correspondences can think to carry on between customers machine and servers. For example, in the c
39、enter the layer can think is a head.Server The physics realization of the system can carry on through many different paths.The underneath wills discuss three layer logic models three kinds of to carry out the method:1.Fat customer machine realizationMany layer (the multi tier) realizations of fat cu
40、stomer the machine realization three layer models of a kind of carry out the options is in the customers on board movement business and expression services. This probably writes the most common path in the Visual Basic application procedure for the SQL Server. This kind of carries out the physics up
41、 only two layers:The server provides the data service only, this kind of method contain 2:00 shortage. First, was the applied procedure to compute the on board increment at the customer, customers calculators need to be stronger, this will increase the system expense, because the system usually take
42、s several customers machines. When the system takes to have the number with thousand million of customers machine, this kind of method will become too expensive. Another 1:00 shortage is a possible increment maintenance expenses. Move to the change of legitimacy logic and the business rule of the sy
43、stem and will cause upgrade customers machine procedure each time. If the system contain customers machine of the equal quantity, this is blem. The biggest advantage of the machine realization in fat customer is to reduce the network discharge, if the legitimacy and the business rules need not
44、be decide by the database. Under this kind of circumstance, only pass the data of the legitimacy logic and can spread toward server. Be the example of the importation data legitimacy,suppose the reader to have a small form (for example national form of name) to put in customers machine. If the data
45、entrance mold piece checks the native watch but is not a more national name in main database, then will reduce the network discharge obviously. Another an important use is in the development process of the system.If the head developer was limited to the interview carry behind, for example, cant pass
46、 the data in the database to verify to input the legitimacy, so, this kind of method can make it right processing data.2. Thin customer machine realizationIn thin customer the machine realization, business the service locates the server, the business logic usually expresses for saving process.The Se
47、rver, the saving process usages T-The SQL plait write. This kind of realization is like fat customers machine to carry out the similar physics up only two layers.The advantage of this kind of method is to reduce the system expense, because thin customers machine needs the less system resources, this
48、 have very important many systems of customers machines to take. And, support the expenses to also compare the fat customer the machine system is a little less, because the code carries the concentrated control in the server. If the business rule is depend on in the data of the database, thin custom
49、er the machine realization reduces the network discharge. The main shortage of this kind of method is a saving process to lack the vivid. The Visual Basic provide stronger than the T-SQLthe plait distance ability that have to have another. Notice three the thin customer of the layer model the machin
50、e physics realization sometimes is called the fat server (the fat Server) model to confuse with thin customers machine/ server calculation model by avoid, the latter points a kind of thin customer the machine hardware equipments and techniques are for example the Citric.3. Many layer realizationMost
51、 in brief many layer realizations are three layer realizations, many possible three a kinds of the layer model physics realizations. In this kind of realization, Link the SQL Server usage data service business to serve the thin customer of the machine expression service data service business service
52、 of fat customer from the Visual Basic the machine expression service data business the service be an alone the progress circulate. That progress can install for serve in the data same set server of the place or at another one server of the dissimilarity. The key characteristics of this kind of real
53、ization is the data service, business to serve the different from expression serve to can do for separation of progress movement in calculator. Three layer realizations.连接 SQL Server数据库我们先介绍一下数据库的基本知识,算是学习数据库编程前的热身运动吧!1. 热身运动首先需要声明是, 我们这里介绍的数据库知识都是指的关系数据库。 所谓关系数据库就是将数据表示为表的集合, 通过建立简单表之间的关系来定义结构的一种数据
54、库。不管表在数据库文件中的物理存储方式如何, 它都可以看作一组行和列, 与电子表格的行和列类似。在关系数据库中,行被称为记录,而列则被称为字段。此表中每一行是一个记录, 包含了特定客户的所有信息, 每个记录则包含了相同类型和数量的字段:客户号、姓名等等。表 是一种按行与列排列的相关信息的逻辑组,类似于工作单表。字段 数据库表中的每一列称作一个字段。表是由其包含的各种字段定义的每个字段描述了它所含有的数据。 创建一个数据库时, 须为每个字段分配一个数据类型、最大长度和其它属性。字段可包含各种字符、数字甚至图形。记录 各个客户有关的信息存放在表的行,被称为记录。一般来说,数据库表创建时任意两个记录
55、都不能相同。键 就是表中的某个字段,或多个字段,它们为快速检索而被索引。键可以是唯一的,也可以是非唯一的, 取决于它们是否允许重复。唯一键可以指定为主键,用来唯一标识表的每行。例如,在前面的例子中,客户标识号 (客户号 )是表的主键,因为客户号唯一地标识了一个客户。关系 数据库可以由多个表组成,表与表之间可以以不同的方式相互关联。规范化数据库设计者的任务就是组织数据, 而组织数据的方法, 应能消除不必要的重复,并为所有必要信息提供快速查找路径。 为了达到这种目标而把信息分离到各种独立的表中去的过程,叫做规范化。规范化是用许多指定的规则和不同级别的范式来进行规范的复杂过程。 该过程的研讨已超出了
56、本文的范围。 但是,大多数简单数据库的规范化可以用下面简单的经验规则来完成 :包含重复信息的表必须分成独立的几个表来消除重复。如果有选学了十二门课程的 1000 名学生,门课程的说明和教师将显示 100 多次对选了那门课程的每个学生都要重复一次。 要避免这种低效率, 应当把表分成两个独立的表来规范化, 一个用来表示学生, 一个用来表示课程。 现在表被规范化了,所以,要改变特定课程的课程描述或 “数据”,只要改变一个记录就可以了。以上是关于数据库的基本知识, 是学习数据库编程所必须的。 虽然数据库技术作为一门学科, 深度和广度不是这点篇幅能描述的, 但作为入门和简单数据库编程应该是足够了。 好了
57、,下面我们就可以开始练练了。 我们经常遇到数据库系统是登记系统,不管你是在单位,或是参加什么组织,登记是免不了的,而且它的结构比较简单, 我们就以一个登记系统为例吧。 分析一下该系统所涉及到的数据。2.磨刀不误砍柴功对于登记,要跟踪的信息包括, 姓名、性别、籍贯、年龄、出生年月、单位、地址、邮政编码、电话、传真当然,可以简单地创建一个表,使得上述的每个数据项对应一个字段。现在需要给表指派主键 ,用以唯一标识每一条记录 ,在登记表中分别添加登记号作为唯一键 ,这样就保证数据库中的任两条记录都不同了。对数据库做出以上分析后,我们就可以开始建立数据库了。3.建营扎寨.在这里我们学习怎样建立数据库,首
58、先需要确定要建立数据库的类型。在 Visual Basic中通过数据访问控件或数据访问对象( DAO)可以访问下列数据库1)JET数据库,即 Microsoft Access2)ISAM数据库,如dBaseFoxPro等3)ODBC数据库,凡是遵循 ODBC标准的客户 / 服务器数据库。如:Microsoft SQL Server、Oracle一般来说,如果要开发个人的小型数据库系统, 用 Access数据库比较合适,要开发大、中型的数据库系统用 ODBC数据库更为适宜。 而 dBase和 FoxPro数据库由于已经过时,除非特别的情况,否则不要使用。在我们的例子中,当然选用Access数据库了。建立 Access数据库有两种方法:一是在 Microsoft Access 中建立数据库。点击“
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 福建省莆田市2023-2024学年高二下学期7月期末考试历史
- 湖北科技出版社三上生命安全教育教案
- 学校安全教育教案
- JGJ18-2012钢筋焊接及验收规程
- 专利技术转让私人居间合同
- KTV木工修缮合同范本
- 4S店涂装油漆施工合同
- O2O建材家居平台建设运营商业计划书
- 2024年软件公司竞业禁止
- 2024年重庆货运资格证模拟考试题
- 2024-2030年中国工业脱水机行业发展状况及投资方向分析报告
- 网络传播法导论(第2版)课件 第五章 侵害名誉权
- 环评手续转让协议(2篇)
- 上海市高行中学2024-2025学年高二上学期9月质量检测数学试卷
- 胸外科快速康复护理课件
- 医院污水处理运维服务投标方案(技术方案)
- 2024年高考最后一套压轴卷-文综试题(全国甲卷)含解析
- 苏教版数学长方体与正方体表面积解析
- 2024年国家开放大学形考作业答案
- 2024年湖南长沙环境保护职业技术学院招聘专任教师历年(高频重点复习提升训练)共500题附带答案详解
- 中考数学专题训练一元二次方程(50道计算题)(无答案)
评论
0/150
提交评论