数据库用户接口英文文献翻译_第1页
数据库用户接口英文文献翻译_第2页
数据库用户接口英文文献翻译_第3页
数据库用户接口英文文献翻译_第4页
数据库用户接口英文文献翻译_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、本科毕业设计(英文文献翻译)数据库用户接口有能力的数据库应用设计者和创建者总是被当作公司或者商业的巨大资产,并且应当这样。在用户需要通过局域网、广域网或者因特网交互数据时,这些人能够解决许多关键性的问题。如果你已经构建起数据库系统,剩下的就只是如何构建接口来让用户与这些系统进行交互。还有一些其它方面你需要了解,例如:设计一个适合三层构架的系统,这些将在以后讨论。当今的银行、商店以及许多企业的日常工作都是基于一定数据库系统来完成。如果没有数据库系统,它们将不能有效地运转。这就是开发者发挥他们才能和不可或缺作用的地方。为了能够绑定一个用户接口,如果可以的话,也可以绑定其他相关商业部分,数据源是很有

2、价值的一个资本。想想最近一次你使用应用程序,也许是一本雇员电话本、顾客数据库、清单程序,或者是财政程序,想想它们如何收集数据并且用一种友好的方式展现给你。一旦能够建立这些形式的应用,就拥有了能够很容易地进行信息处理的潜能,能够给整个公司带来利益,这就是为什么程序员成为如此珍贵资本的原因。 当今的许多公司都雇佣一个个人或者群体专门进行已存在的数据库的管理即就是数据库管理员(DBAs)并且拥有一组单独的开发人员,他们的任务是进行自己应用程序的创建。但是,作为数据库开发者的你常常兼有这两方面的工作,所以你需要深入了解这两个任务。数据库管理员的职责包括: 数据库构架知识和如何高效地运用和存储信息。 使

3、数据库能够正常运行的能力。 洞察公司在成长和扩大中的需求变化的能力现在的数据库框架能否处理十倍甚至百倍数量级的信息而保持高效率? 当进行用户接口设计时有一套逻辑方法,屏幕按一种用户能够理解的方式进行组织例如相关组进行控制,比如用户和地址字段。 与用户紧密地工作来设计这些系统的能力。 在进行客户服务器应用程序时这些将会有帮助。当我们开发数据库时我们需要考虑诸如:效率、灵活性、处理多用户、数据锁定、数据增长、完善性和性能等。开发可户端应用程序的人员需要像考虑程序性能和效率一样考虑用户接口界面。拥有一个聪明的想法:知道用户将会如何与数据库系统进行交互将会帮你决定如何设计它。用户在运行任务时总是按一定

4、的顺序运行特定的程序,某些任务比其他的要用的多。例如,如果你在设计一套储备清单程序,你也许想让你的系统在开启时显示能让用户更改清单的界面,而不是添加新产品行。 在这章中,我们将来看看为一个SQL 数据源建立一个基本用户接口的重要基本。我们也将看看当你建立一些更老练的数据库应用时所应该应用的一些好的实践。下面就是我们为此目的而要覆盖的主题: 一个用来访问数据库的简单用户接口 怎样填充一个DataGrid 运用向导 幕后产生的代码 一般用户接口设计的好的实践1 用户接口 既然你已经学会了怎样运用合适的SQL 语句来设计数据库并且更新数据库里的信息。我们不能等待我们的用户去开发一套数据库管理工具并且

5、像这样来操纵数据,因此,我们下一步就是要创造某种途径来让用户去访问信息。这就是用户接口的作用提供一种用户和数据库的通信手段。 通过用户接口,用户可以与数据交互并且操纵它来完成一定的任务,比如:查看、添加、更新或者删除细节。用户接口和数据库亲密地进行工作,并且正确结合,用户能够不用任何特殊的技术知识而处理大量的信息。 需要某中思考过程或者方法来为接口提出一种好的设计:我们想建立一个一致并且和谐的界面以便这个接口对将要用它的用户来说是容易接近的。我们应该知道现存的数据逻辑,当让用户进行像添加和删除信息时保证这些动作是正确的,防止用户不经意的操纵数据造成一些对企业来说不可恢复的损失。安全性和数据完整

6、性很重要,因为它们提供了机制来保证用户不能调整他们自己财产的平衡,修改他们自己的奖金,或者查看甚至修改其他用户的信息。我们需要一种方法来隐藏幕后的制衡。这些中的许多都可通过好的框架设计来完成,来造成一种能够访问、使之有效并且保护这个信息,或者通过框架后的代码或者让这些框架去调用另一个对象。还有一种可能性是一个恶意的用户可能会完全饶过这些模型,并且尝试着去直接访问数据库,因此严密的安全是非常重要的。为了达到这个目的,我们的模型应该制作成一个带有保密用户ID 和密码的数据库,我们能通过存储过程隐藏我们的制衡信息也就是存储在数据库服务器端的程序。这些存储过程能履行一些基于已通过参数的标准,并且只有当

7、正确的安全信息通过时才返回信息。所有的这些都是通过商业规则来完成的,这些规则提出这样的要求:数据在特殊的与我们的生意有关时如何维护。 既然我们已对与用户接口相关的问题了解了一部分,我们可以继续来看看我们怎样在Visual Basic .NET 里创建一个接口。这个应用程序的基本要素是窗体框架,它们可以被看作是一个等待被画入的白布。我们可以在这个框架中放置控件来为我们的接口设计一种有逻辑性的界面,并且为用户提供一种自然而简单的途径来让用户与数据库交互。2 ADO.NET 概述 在我们开始创建我们的应用程序之前我们需要来学习一下我们的应用程序将要用到的一些ADO.NET 基本要素和向导。我们将在下

8、一章中更详细地描述ADO.NET ,因此,现在我们将仅学习一下基本来使我们通过这个简单的数据库工程。 ADO.NET 提供给我们一种收集数据和信息并且通过一个用户接口展示数据的方法。通过运用一些要素,我们能够联系上各种数据源然后创建一个访问数据库的用户接口。 我们需要四个部分来创建我们的ADO.NET工程。1. 一个数据源真正的数据被存储的地方,我们的数据库2. 一个Connection对象来将我们联系到我们的数据库3. 一个DataAdapter对象来创建一种读取和向数据库中写入的机制4. 一个数据集对象它将包含我们将要用到的表 首先,我们需要一个与数据源的连接,被一个Connection

9、对象所提供。该对象要求一定的信息来与数据库连接。Connection对象被DataAdapter对象所调用,DataAdapter对象处理命令来对数据源进行选择、更新、插入和删除数据。最后,我们有一个DataSet来装入我们的表并且它通过DataAdapter填充自己并且对数据源中的数据进行更新。一、数据源数据源是描述提供给我们数据的任意信息集合的规定。它可能采取数据库, XML 文件的形式, 报表, 甚至一个文本或二进制文件。它只采取一两个代码行使我们改变我们连接的数据源。Windows环境提供我们公共类用于我们的程序用相同的代码与不同的数据源通信。二、数据连接我们连接数据库的第一件事是数据

10、连接对象。它引用二种形式- SqlConnection 或OleDbConnection 对象。就像我们操作SQL 服务器引擎, 我们将使用SqlConnection 对象。当我们使用SQLConnection对象创建连接时,我们需要使用下面的连接参数: 数据源-数据源被放置位置的服务器名字。数据源可能被放在任何地方, 可能是在网络或互联网上。通常, 您使用你的本地网络,你便需要存放数据源的专门计算机名字。我们也可用localhost 或(local) 来代替我们运行程序的计算机。这项术语,当它作为当前,本地计算机时,由许多Windows 应用使用。 用户标识和密码-连接数据源所需要的认证,用

11、户标识和密码是由数据库管理员建立的,他防止其他用户在未经允许的情况下查看或更改数据库。 初始化日志这是我们想要与之工作的数据库。 为了创建一个新的连接,我们声明一个新的SqlConnection 并且运用以下所示的这些参数设置ConnectionString 属性:Dim myConnection As New SqlClient.SqlConnection()myConnection.ConnectionString = Data Source=localhost; & _Initial Catalog=NorthwindSQL;UserId=sa;Password=sa;或者,我们可以将连

12、接串作为一个参数传递给SqlConnection ,如下所示:Dim myConnection As New SqlClient.SqlConnection(Data Source=localhost; & _Initial Catalog=NorthwindSQL;UserId=sa;Password=sa; 创建一个新的OleDbConnection 对象是简单的,除非我们同时需要一个提供者参数来描述我们正在连接的数据源的类型。因此,为什么我们不需要那个与SqlConnection 对象相关的参数?你已经掌握它了因为提供者类型将会一直是SQL 并且,实际上如果你真的试着将提供者参数设置为S

13、qlConnection 对象,你将会出错。 现在我们可以来看看这个需要一个数据连接对象来建立以便能运转的要素,即就是DataAdapter 。三、DataAdapter DataAdapter 是位于数据源和数据集之间的一种机制。我们拥有两种类型的DataAdapters :SqlDataAdapter ,专门为SQL Server 数据库所使用;OleDbDataAdapter ,被所有的数据源所使用并且通过另外一个被称为OLE DB的层。因此,通过防止这个额外层的需要,SqlDataAdapter 提供更快数据的访问。OleDbDataAdapter 可以被用来访问SQL Server

14、,但是,因为它通过OLE DB 层,如果你打算就用SQL Server 而不是任何其他的,为了达到最好性能你将被建议保持和SqlDataAdapter 一致。这适合这章中的简单数据库应用程序,因此我们严格与SqlDataAdapter 一致地工作。DataAdapter 允许进行选择、更新、删除或者向数据源中插入数据。这些方法通过使用SelectCommand, UpdateCommand, InsertCommand, 和DeleteCommand属性来设置为了特定操作所需要的数据库命令字符串来实现。这些属性中的每一个都是一个命令对象的例子,它们的工作即就是执行一个SQL 语句或者存储过程并

15、且返回一个结果集。对一个SQL 数据库来说,命令对象将保持着为规定操作实际所需的选择、更新、插入和删除语句,比如:SELECT * FROM Products 或者DELETE FROM Orders WHERE CustomerID=ABC。命令对象还存储着连接信息因此它能够连接上数据库来执行它所包含的SQL 语句。在此指出,在我们简化了的例子中,我们将仅用SelectCommand 工作因为我们只需要从我们的数据库中选择信息来进行查询。 因为我们和一个SQL 数据库打交道,我们将利用SqlCommand 对象(和OleDBCommand 对象相对应)。当我们利用DataAdapter 向导

16、时,对每个表来说你都将有一个对应的DataAdapter 。 当我们运用向导时,为了使选中的表能够拥有所有的对其更新和恢复信息,DataAdapters 被特别配置。为了对另外一个表重用它,我们主要需要重建组成DataAdapter 的对象,这意味着所有的命令对象都要被重建。简单的解决方案是每个表分配一个DataAdapter ,这样帮助你让你的代码保持整洁并且容易维护。当你建立一个DataAdapter 时,如果需要你可以明确指定多于一个表。比如,我们可以创建一个联系顾客表和订购表的DataAdapter 来使我们能够只用单个DataAdapter 就能从两个表中查看信息,而不需要任何的代码

17、来连接它们。但是,当遇到更新信息时,这种将多个表连接成一个表视图的方法就运行的不是很好,因为DataAdapter 向导不能够适当将表连接起来来串联更新和删除,强化了一个表一个DataAdapter 的情况。四、数据集 最后,一个数据集是表的一个容器或者集合;它能够包含一个或者多个表并且在主存中被维护。表间关系也被保存在这里。它所保持的表将诸如顾客详细情况或产品信息的信息以记录或行的格式包含在一起。一个表可能包含几千个这样的行。 一个有用的说明是将一个数据集想象为保持一个书籍出版者的细节。一个有技术的出版者可能以几种类别发布书刊,比如像.NET,JAVA,ASP和C+ 。在每个类型中都是单独的

18、书刊因此一个.NET 类型应该拥有像专业版VB.NET ,基本VB.NET ,专业C#,和引领.NET 。一张表应能代表这些种类中的一种,并且一个类型内的每本书应该被适当的表中的一行所代表。每一行保持着每本书的细节例如:标题、价格、ISBN 编号、出版日期和页数等。 对于你能向数据集中存储的信息类型并没有限制。既然我们已经了解了一个数据集的内部细节,就让我们来看看怎样在一个应用程序中应用一个数据集。 对我们的程序来说,我们将需要建立一个SqlDataAdapter 对象来从向导数据库中通过一个SqlConnection 对象选择顾客记录。这个连接将被仅仅维持完成SQL 选择操作的时间。我们将通

19、过运用SqlDataAdapter 对象把我们的顾客表中数据填充到我们的数据集中。连接,或者数据绑定,对诸如DataGrid 控件的可视化控件将会在窗口模型中展示数据集中的内容。 现在我们可以在我们简单的数据库应用程序中执行这些控件。下面是以下任务的一个概述: 创建一个窗口应用程序 与一个数据源建立连接 向我们的框架中添加一个DataAdapter 从DataAdapter 产生一个数据集 向我们的框架中添加一个DataGrid 控件 在我们的DataGrid 中显示顾客表的内容 我们以创建一个新的Visual Studio .NET 应用程序然后再向工程中添加一个SqlDataAdapter

20、 作为开端。我们仍然需要为DataAdapter 创建一个与NorthwindSQL 数据库联系的连接。从SqlDataAdapter 我们将创建一个新的数据集。一旦我们有了数据集,我们将向我们的框架中添加一个DataGrid 并且将数据集和它绑定。最后,我们将添加一个按扭来将顾客记录填充到数据集中,并且在DataGrid 中展示出来。 Visual Studio .NET 的配置向导为我们提供了一个简单的方法来做这些。现在我们离创建我们的数据库应用程序只有一点点距离了!3 数据访问简史 数据访问方法自从Microsoft Access 1.0 和Visual Basic 3.0 时就存在了。

21、数据库存取工作利用Visual Basic 变得很容易,好象他们仍然在为简单桌面应用程序做工作。 Visual Basic 中的第一个数据模型被称为数据访问对象(ADO),在Visual Basic 3.0 中介绍。它能够与Microsoft Access 和其他类型的数据库交互,尽管它对于你的台式计算机来说很好用。它很容易被用因为它提供了简单的数据访问方法和工具,从Visual Basic IDE 环境而来,比如说数据绑定控件。这些工具和大量的诸如书籍和技术报告之类的资源,意味着你能够紧接着很快使一个数据库应用程序运转起来。Visual Basic 环境和一个数据管理者连接在一起,这个管理者

22、允许创建和管理数据库存取,并且,当你将你的应用程序分散时,创建进程允许对任何需要的数据访问图书馆进行简单选择。它仍然允许你写入并运用一套代码来访问不同的数据源,因为,只有一件事改变,即你所想连接到的数据源的类型。这些数据源主要是非关系数据库。 非关系数据库通常是作为连续二进制流存储的平文件。ISAM(索引顺序存取方法)数据库运用这种类型并且提供一种控制计算机怎样访问存储在硬盘上记录和文件的途径。数据被连续地存储,直接访问一个具体的记录需要运用索引。这些文件的结构十分复杂。很多读取这种类型数据的引擎,在访问记录时非常的迅速而有效,因为不需要通过多余的层,并且他们可以直接访问数据。这样隐藏着一个不

23、好的方面,即它们缺乏任何安全机制来保护数据,任何人都可以进入查看或者编辑数据库中信息,并且也没有历史事务被维持来记录是谁、什么或者什么时候记录被改变了。这种系统不是为多服务框架而设计的,在多服务框架里进程可以被分开来使顾客计算机做很多的数据进程工作。它们对多用户环境的适应力很差,并且也不提供固有的机制来阻止用户同时进行的相互有影响的改变操作。作者:里克特.J来源:深入理解.net6本科生毕业设计(英文文献)The User Interface for the DatabaseCapable database application designers and builders are inva

24、riably considered a great asset to a company or business, and rightly so. Such people are able to solve a number of problems in situations where users need to interact with data be it accessed over a LAN, WAN, or the Internet. Once you have acquired the knowledge to build database systems, there rea

25、lly only remains the know-how to build an interface that allows users to talk to these systems. There are other aspects of development you need to be aware of, for instance designing a system geared towards a three-tier architecture, and these will be discussed later.Banks, stores, and most business

26、es today all depend on some type of database system for their day-to-day operations and, without it, they would no longer be able to run efficiently. This is where you as the developer have a crucial role to play. To be able to tie a user interface, and other related business components if desired,

27、to a data source is a valuable asset. Think of the last application you used around your office, perhaps an employee phonebook, customer database, inventory program, or finance program, and how they all gathered data and presented it to you in a friendly manner. Being able to build these types of ap

28、plication, that have the potential to make dealing with information so much easier, can bring great benefits throughout a company, and so it is that such programmers become highly valued assets. Many companies nowadays employ a person or group solely for the management of existing databases the data

29、base administrators (DBAs) and have a separate team of developers whose job it is to build the applications themselves. Often, however, you as the database developer will be playing both roles, and so you will need a basic understanding of both tasks. The DBAs responsibilities include: Knowledge of

30、the structure of the database and how to use and store information in an efficient manner The ability to normalize a database, as talked about in the Chapter 1 Insight into the changing demands of the company as it grows and expands will the database in its present form be able to handle ten or even

31、 a hundred times the amount of information and remain efficient? A logical methodology when it comes to the user interface design, so screens are organized in a way that makes sense to the user for instance grouping related controls together, such as customer and address fields. The ability to work

32、closely with the user to design these systems.This will all help when it comes to developing client-server applications. When we develop databases we need to consider such things as efficiency, flexibility, handling multiple users, data locking, data growth, integrity, and performance. The person de

33、veloping the client-side of the application needs to worry about how the user interface will look as well as the performance and efficiency of the application. Having a clear idea of how users will interact with your database system will help in determining how it should be built. Users will often p

34、erform certain procedures in a certain order when undertaking tasks, and some tasks will be much more common than others. For instance, if you are designing a stock inventory application, you might want your system to start up with the screen that allows users to make changes to the inventory, rathe

35、r than, say, the screen for adding new product lines.In this chapter, we look at the fundamentals of building a basic user interface to a SQL data source. Well also look at some good practices that you should apply when building more sophisticated database applications. Here are the topics we will c

36、over to this end: A simple user interface for accessing a database How to populate a DataGrid Using Wizards The code generated behind the scenes Good practices for general user interface design1 The User InterfaceSo youve learned how to design a database and how to update information in it using sui

37、table SQL statements. We cant expect our users to open up an administrative database tool and manipulate the data directly like this, so our next step is to create some way for users to access information. This is the role of the user interface to provide a means of communication between the user an

38、d the database.Through the user interface, users may interact with data and manipulate it in order to accomplish certain tasks such as to view, add, update, or delete details. The user interface and database go hand in hand, and with the right combination, users are able to handle massive amounts of

39、 information without any particular technical knowledge.Some type of thought process or methodology is required to come up with a good design for the interface: we want to create a consistent and appropriate look so that the interface is readily accessible to those who are to use it. We should be aw

40、are of existing business logic when allowing the user to do things like add or delete information to ensure its done correctly and to prevent users from inadvertently manipulating data in a way that could potentially result in irrecoverable losses to the business. Security and data integrity are imp

41、ortant, for they provide the mechanisms to ensure users are not able to adjust their own bank balances, modify prices themselves, or view or even change other peoples information. We need a way to hide the checks and balances behind the scenes. Most of this can be accomplished through good design of

42、 forms, to build in the capability to call upon, validate, and protect this information; either through the code behind the forms or by having the forms calls another object. There is also the possibility that a malicious user could bypass these forms entirely, and attempt to directly access the dat

43、abase, so watertight security is vital. To achieve this, our forms can be made to access the database with a secret user ID and password, and we can hide our checks and balances through stored procedures that is, procedures stored on the database server. These stored procedures can perform some vali

44、dation based on what parameters are passed, and only return information when correct security information has been passed. All this is accomplished through business rules, which dictate how data will be maintained in the particular scenarios relevant to our business.Now that we know a little about t

45、he issues involved with the user interface, we can move on to look at how we can build an interface in Visual Basic .NET. The fundamental component of this type of application is the Windows Form, which can be viewed as an empty canvas waiting to be painted on. We can place controls on such a form t

46、o create a logical look and feel for our interface, and provide a natural and intuitive way for the user to communicate with our database.2 A Brief Introduction to ADO.NETBefore we can begin creating our application we need to learn about some basic components of ADO.NET and wizards that our applica

47、tion is to use. We will go into greater detail on ADO.NET in the next chapter so, for now, well learn just enough to get us through this simple database project.ADO.NET provides us with a way of gathering data and information and presenting it through a user interface. By using some components, were

48、 able to connect to various data sources and can then build a user interface that accesses a database.We need four pieces to build our ADO.NET project:1. A data source where the actual data is stored, our database.2. A Connection object for connecting us to our database.3. A DataAdapter object to pr

49、ovide a mechanism for reading and writing data to the database.4. A DataSet object this will contain the table(s) that we will use.Firstly, we need a connection to the data source, provided by a Connection object. The Connection object requires certain information for it to connect to the data sourc

50、e. The Connection object is called by the DataAdapter object, which handles commands to select, update, insert, and delete data in the data source. Finally we have a DataSet that contains our tables and which uses the DataAdapter to populate itself and to update information in the data source.一、The

51、Data SourceA data source is the term used to describe any collection of information that can provide data to us. It can take the form of a database, an XML document, a Microsoft Excel spreadsheet, or even a flat text or binary file. It only takes one or two lines of code for us to change the kind of

52、 data source that we connect to. The Windows environment provides us a shared set of classes for use in our programs to communicate with these different sources using similar code.二、The Data ConnectionThe first thing we need to connect to a database is the data Connection object. This comes in two v

53、ersions either a SqlConnection or OleDbConnection object. As we are working with the SQL Server Desktop Engine, we will use the SqlConnection object. When we create a connection using a SqlConnection object, we need to feed it the following connection parameters: Data Source the name of the server w

54、here your data source is located. The data source can be anywhere, be it on your network or somewhere over the Internet. Usually, you will be working on your local network and so you need to specify the name of the computer that holds the data source here. Alternatively, we can give the name localho

55、st or (local) to signify that we want to use the computer that is actually running the application. This terminology is used by many Windows applications when it is necessary to identify the current, local computer. User ID and Password the authentication details required to communicate with the dat

56、a source. The ID and password is set up by the database administrator and helps prevent people from viewing or modifying the database without permission. Initial Catalog this is the name of the database we want to work with in this case, NorthwindSQL.To create a new connection, we declare a new SqlC

57、onnection and set the ConnectionString property using these parameters as shown here:Dim myConnection As New SqlClient.SqlConnection()myConnection.ConnectionString = Data Source=localhost; & _Initial Catalog=NorthwindSQL;UserId=sa;Password=sa;Alternatively, we can pass the connection string as a par

58、ameter to the SqlConnection as follows:Dim myConnection As New SqlClient.SqlConnection(Data Source=localhost; & _Initial Catalog=NorthwindSQL;UserId=sa;Password=sa;Creating a new OleDbConnection object is similar, except that we also need a Provider parameter to describe the type of data source that we are connecting to. So why dont we need that parameter with the SqlConnection object? Youve got it because the provider type will always be SQL and, in fact, if you do t

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论