外文文献翻译---ADONet技术

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

英文一原文:
ADO. Net Technology
ADO. NET is designed for solving the Web and program problem about the distribution application by Microsoft. As a kind of visit frame of database, ADO. NET can handle the N layer's data architecture which doesn't join that Web application program requires, thus when visiting the database of SQL SERVER, superior performance has gotten extensive application. This paper discusses for this.
I.The major object of .
Many objects in is similar to the object function in ADO , but the function of the object in is more powerful. At the same time, except the objects of the Connection, Parameter and Command , ADO. NET also add a lot of new object and program melt interface, such as DataSet, DataView, DataAdapter, DataReader and DataSetCommand etc..It make more simple to operate the database.
I.a DataSet object: DataSet is the core of , is specially used to handle the data which is read out from the stock , and keep it in local memory as away from line. We can use identical way to operate the data which is got from the different data source, the behavior of DataSet is consistent whatever the base layer database is SQL Server or Oracle. In DataSet, it can contain arbitrary quantity of DataTable, and every DataTable is in correspondence with Table or View in darabase. Generally speaking,a corresponding DataTable is a set of a group of DataRow and DataColumn for the data sheet of elephant.DataTable can take the responsibility for defending each data trip to retain it's initial state and current state, with the concurrent that solves database visit problem. reduce the pressure of being away from line to join pattern decreasing for data server.
I.b DataReader object: When looking over mass data with the way that glanced over , it will occupy plenty of memories and cause performance to drop.
For instance,when a link (Connection ) reads the record of 1000 lines of database by using the traditional ADO Recordset ,it must give this link memory distribution for this 1000 lines of record untill the life period of this link finish. If there are many users carrying out the same operation for same computer at the same time,the memory will be used out. To solve these problems, DotNET frame has offered DataReader object, from database,it return a read-only string, which can roll downward only to flow ( Strem ), and exists a record every time only in courently.
I.c DataView object: DataView object representative one DataTable approach by looking over , it is to put data in order with the form of form that what data acquiesce in look over way, and the order of data that put data in order follow the order taking out the trip that put litre and the fence position of row order in order from database data sheet, usually it is concerned with the Sort Order or reduce power in inquiring string when design the database .ADO. NET offer the way that has elasticity very
much to let user use row order and condition filter , seek etc. property way of looking over of defining difference , so, edit and glance over data or show the data in DataTable .For instance ,we can establish a DataView object, then designate with with default look over ( DefaultView ) different row order way, or also can use condition filter ( Filter ) look over the partial data in data sheet. This kind of way can tie two above control items to a same data sheet, but what show is thay the different data.
I.d DataAdapter object: ADO. NET establish and initialize data sheet through DataAdapter, so as to keep the data in the memory combining with DataSet object. DataAdapter object can hide the details that links up with Connection and Command. DataAdapter object allow to put the data to the data source ( DataSource )which gets from DataSet object.It can also take out data from data source. By the same way,it can also operate the bottom data preserved by adding ,deleting or modifing.
II.Visit Database in joining
II.a The analysis of a example which visit the database of SQL SERVER in technology
[ abstract ] With the thorough that applied along with distributed database, permanent database connection consumes resource fairly. When visiting the database of SQL SERVER, it can solve this problem perfectly with ADO . NET technology . This paper primarily discusses Net the major object of , and analyse the course of visiting SQL SERVER furtherly.
[ keyword ] ADO. NET visit XML independently
Drawing the bottom graph of the map, add new picture layer according to the fuction of defined , Setting picture layer visibility and so on:
/ / constructs function
function FlashMap ( width: Number, height: Number, Geo_x: Number, Geo_y: Number ) { layersCount = 0;
layers=new Array();
stageWidth=width;
stageHeight=height;
x=Geo_x;
y=Geo_y;
Map_mc=_root.createEmptyMovieClip("Map_mc",0);
Map_mc.createEmptyMovieClip("Map_mc",-200);
}
//create object
Map = new FlashMap( stagewidth, stagehight, Mapx, Mapy);
//Loading map
function initMap () { Map. drawMap ();}
II.b The information inquiry of the map datas:The inquiry of datais was mainly carried out by the click of mouse and the choose of frame on the flash which is loaded with the line,the point and the side of layer .We can see whether the field of the mouse choosing contain the object data through querying the courrent layer of the picture ,if exiting,to return the inquiry result in the new Form simplyand show it to the user. The code of the script of mouse option:
Function select ( )
{ var selectedRegion: Array;
selectedRegion=new Array();
for(j=0;j<yersCount;
j++){var coverLayer:MapLayer=yers [j];
for(i=0;i<converLayer.Regions_ary.length;
i++){var Region:MapRegion=MapRegion(coverLayer.Regions_ary [i]);
if(Region.isInRegion(_root._xmouse,_root._ymouse)){selectedRegion.push(coverLay er);
selectedRegion.push(Region);
}
}
}
III. The practice of concluding remarks proves , in database the campus geography information that doesn't request too high, development data to lose comparatively demonstrate aspect, this is a kind of practical feasible , development the easy method with cheap cost. Besides, with the network electronic map colour of this kind of method produce completion, it is rich , content much shape, if wander the network electronic map plane of fictitious realistic technology and this kind of produce method that combines and can come true the environment of campus geography with space wander. This kind of network electronic map demonstrate effect is traditional GIS software which is nearly impossible to reach , in campus situation demonstrate and construct sub-district demonstrate etc. field ,this kind of method have greater develop potential.
中文一译文:
技术
是Microsoft 为解决Web 和分布式应用程序问题而设计的。

作为一种数据库访问框架, 能处理当今N 层的Web应用程序所要求的非连接数据体系结构, 因而在访问SQL SERVER数据库时, 性能优越, 得到了广泛应用。

本文对此进行了讨论。

一、 的主要对象
中有很多对象与ADO 中的对象功能相似, 但 中对象的功能更强大。

同时, 除Connection、Parameter、Command对象外 还添加了许多新的对象和程序化接口, 如DataSet 、DataView、DataAdapter、DataReader、DataSetCommand 等,
使得对数据库的操作更简单。

1、DataSet 对象: DataSet 是 的核心, 是专门用来处理从数据存储中读出的数据, 并以离线方式存在于本地内存中。

可以使用相同的方式来操作从不同数据来源取得的数据, 不管底层的数据库是SQL Server 还是Oracle, DataSet 的行为都是一致的。

在DataSet 中可以包含任意数量的DataTable, 且每个DataTable 对应一个数据库的Table 或View。

一般来说, 一个对应DataTable 对象的数据表就是一组DataRow 与DataColumn 的集合。

DataTable 会负责维护每一笔数据行保留它的初始状态和当前的状态, 以解决数据库的
并发访问问题。

的离线连接模式减少了对数据服务器的压力。

2、DataReader 对象: 当以浏览的方式查看大量数据的时候,会占用大量内存, 导致性能下降。

例如, 一个链接(Connection) 用传统的ADO Recordset 对象去读1000 行数据库的记录, 则必须为这1000 行记录将内存分配给这个链接直至这个链接的生命周期结束。

如果有多个用户在同一时间对同一计算机进行同样的操作, 则机器内存将被过度使用。

为了解决这些问题, DotNET 框架提供了DataReader 对象, 从数据库返回一个只读的、仅能向下滚动的串流(Strem), 而且当前内存中每次仅存在一条记录。

3、DataView 对象: DataView 对象代表一个DataTable 的数据查看方式, 数据默认的查看方式是将数据以表格的形式排列, 且数据排列的顺序遵循从数据库数据表中取出数据时行排列的顺序, 通常和设计数据库时的Sort Order 或在查询字符串中指明排序的栏位、
升降幂有关。

提供非常有弹性的方式以供用户利用排序、条件过滤、查找等特性来定义不同的查看方式,从而编辑、浏览数据或显示DataTable 中的数据。

例如, 可以建立一个DataView对象,然后指定和以缺省的查看(DefaultView) 不同的排序方式, 或者也
可以使用条件过滤(Filter) 只查看数据表中的部分数据。

这种方式,可以将两个以上的控制项绑定到同一个数据表, 但显示的是不同的数据。

4、DataAdapter 对象: 通过DataAdapter 对象建立、初始化数据表, 从而和DataSet 对象结合起来在内存中存放数据。

DataAdapter 对象能隐藏和Connection、Command 对象沟通的细节。

DataAdapter 对象允许将DataSet 对象中的数据保存到数据来源(DataSource) , 也可以从数据来源取出数据。

同理,
也可以对底层数据保存体进行数据的添加、删除或修改操作。

二、数据库连接访问
访问SQL SERVER数据库的实例分析
[ 摘要] 随着分布式数据库应用的深入, 永久的数据库联接是相当耗费资源的。

在访问SQL SERVER数据库中, 采用 技术可以完美地解决这个问题。

本文讨论了 的主要对象, 并深入分析了其访问SQL SERVER 的过程。

[ 关键字] 独立访问XML
据其定义的函数绘制地图底层图形、添加新图层, 设置图层的可见性等等:
//构造函数
function FlashMap (width:Number, height:Number,Geo_x:Number,
Geo_y:Number) {
layersCount = 0;
layers = new Array () ;
stageWidth = width;
stageHeight = height;
x = Geo_x;
y = Geo_y;
Map_mc=_root.createEmptyMovieClip (" Map_mc" ,0) ;
Map_mc.createEmptyMovieClip (" Map_mc" ,- 200) ;
}
//创建实例
Map = new FlashMap (stagewidth, stagehight, Mapx, Mapy) ;
//装载地图
function initMap () {
Map.drawMap () ;
}
2.4 地图数据的信息查询: 对于flash 上加载的地图各图层的点、线、面数据的查询主要是鼠标的点选和框选来实现的, 通过查询当前图层中是否有实体对象数据包含在鼠标选择范围内, 若存在则返回简单查询结果在新窗口中显示给用户。

鼠标选择的脚本代码为:
function select () {
var selectedRegion:Array;
selectedRegion=new Array () ;
for (j=0; j<yersCount; j++) {
var coverLayer:MapLayer = yers [j] ;
for (i=0; i<converLayer.Regions_ary.length; i++) {
var Region:MapRegion = MapRegion ( coverLayer.Regions_
ary [i]) ;
if ( Region.isInRegion ( _root._xmouse, _root._ymouse) )
{
selectedRegion.push (coverLayer) ;
selectedRegion.push (Region) ;
}
}
}
3.结束语
实践证明, 在数据库要求不高、动态数据较少的校园地理信息展示方面, 这是一种切实可行、开发容易、成本低廉的方法。

此外,采用这种方法制作完成的网络电子地图色彩丰富, 内容多样, 如果把虚拟现实技术与这种制作方法的网络电子地图结合起来, 就可以实现校园地理环境的平面漫游和空间漫游。

这种网络电子地图的展示效果是传统GIS 软件很难达到的, 在校园地理位置展示和建筑小区展示等领域这种方法具有较大的发展潜力。

英文二原文
The Data Binding Technology
In my project,I need to show the data from the DataBase,so I need to use the data binding technology which Microsoft company support.In the following ,let's discuss it together.
If you are familiar with classic ASP, the declarative data binding syntax introduced in will be familiar to you even though the functionality is vastly different. Data binding expressions are the code you see between <%# and %> characters in an ASPX file. The expressions allow you to easily bind controls to data sources, as well as properties, expressions, and results from method calls exposed by the page. While this feature is easy to use, it often causes some confusion about what is allowed and whether it should be employed.
Data binding basics
Data binding expressions link page properties, server control properties, and data sources when the page's DataBind method is called. You can place data binding expressions on the value side of an attribute/value pair in the opening tag of a server control or anywhere in the page. All data binding expressions, regardless of where you place them, must be contained between <%# and %> characters.
When used with data controls (like Repeater, DataGrid, and so forth), the expression parameter is usually a column name from the data source. However, as long as it returns a value, any valid expression may be used. Likewise, the same syntax may be used outside list controls. This includes displaying values on the page or populating control attributes.
Container.DataItem is a runtime alias for the DataItem bound to a specific item. It maps to an individual item from the data source like one row from a database query or an individual element from an array. The actual data type for the DataItem is determined by the data source. So, if you're dealing with an array of integers, the DataItem will be an integer.
The following list provides a quick review of the syntax for various scenarios:
<%# Container.DataItem %>--An array of string values is returned. <%# Container.DataItem("expression") %>--The specific field from a
DataView container is returned.
<%# Container.DataItem.PropertyName %>--The specific string property value of data source is returned.
<%# CStr(Container.DataItem.PropertyName) %>--Returns a property value converted to its string representation.
When you're using C#, the syntax is a bit different. The following list includes the corresponding C# code for each line in the previous list. Notice the basic syntax is the same, but it changes when property values are returned and converted to the appropriate data type.
<%# Container.DataItem %>
<%# ((DataRowView)Container.DataItem)["PropertyName"] %>
<%# ((ObjectType)Container.DataItem).PropertyName %>
<%# ((ObjectType)Container.DataItem).PropertyName.ToString() %> Syntax is consistent when working with page level properties and methods. The syntax remains the same as long as string values are returned. The following list provides some examples:
<%# propertyName %>--The value for a page level property is returned. <asp:ListBox id="lstValues" datasource='<%# propertyName %>' runat="server">--The value retrieved from the page level property (array, collection of objects, etc.) is bound to the data control.
<%# (objectName.PropertyName) %>--The value of the page level object property is displayed.
<%# MethodName() %>--The value returned from the page method is displayed. You may use individual values (albeit properties, method return values, and so forth) on a page using the following syntax:
<%= Value %>
The C# code in Listing A demonstrates data binding in an Web form. It selects employee names and telephone numbers from the SQL Server Northwind Employees table. The values from the query are displayed via an Repeater control. The column values are inserted via data binding, and the form's window title is populated using a method call. In addition, the ItemIndex property of the DataItem is used to display a row number. The ItemIndex property begins with zero, so one is added before it is displayed.
Listing B contains the equivalent code. The main difference is the use of parentheses as opposed to brackets in C#. Also, the casting of the rows is not necessary with .
Using the Contain.DataItem object can be tedious, since you must be aware of the data type and convert it accordingly for use. Microsoft does provide the DataBinder class to further simplify development.
Microsoft documentation (on MSDN) states the DataBinder class uses reflection to parse and evaluate a data binding expression against an object at runtime. This method allows RAD designers, such as Visual Studio .NET, to easily generate and parse data binding syntax. This method can also be used declaratively on a Web form's page to simplify casting from one type to another.
You can use the Eval method of the DataBinder class to make .NET do the heavy lifting when using data values in an page. The Eval method accepts the previously covered Container.DataItem object; it works hard to figure out the details of the field identified in the expression and displays it accordingly. It has the following syntax:
DataBinder.Eval(Container.DataItem, "field name", "optional formatting")
Using this syntax, you could rewrite the first example to use DataBinder.Eval to look like the C# code in Listing C. Listing D contains the equivalent code.
The DataBinder.Eval approach is great as it pushes work to the system. On the other hand, you should use it with caution, since time and resources are consumed as the system locates the element and determines its object/data type.
Plenty of options
Data binding makes it relatively simple to include data in pages. There are various data binding options available, which include: binding the data to a control and allowing it to decide how it is presented, or choosing declarative data binding to control presentation within the page. In the end, it comes down to your preference, but it is great to have options.
中文一译文:
数据捆绑技术
在我的项目中,我需要从数据库显示数据,因此我使用数据捆绑的技术它是由微软公司支持的。

如下,我们一起来谈论它。

如果你熟悉经典ASP,在介绍申明数据捆绑的句法与它在功能是有很大的不同。

数据捆绑的表达方式:就是能在ASPX文件中以在此形式(< %#和% >)之间出现的代码。

这种表达方式允许你把控件很容易地绑定到数据源,连同属性,语法,结果值同时在方法调用时在页面中显示。

当这些特性轻松的被使用时,由于它是否被允许能够被调用而经常造成一些的混乱。

数据捆绑的基本原则:
当DataBind方法被调用时,数据就捆绑到的控件属性,数据源。

数据表达式可以放置在页面的任何一处,或置于服务器控件成对标签的之间的附值处。

所有数据捆绑的表达式,不论是将它们放置在哪,都必须包含在< %#和% >标志之间。

当数据控件(像转发器一样,DataGrid,如此等等)绑定时,表达参数通常是数据源的一张表的一个列名。

尽管如此,只要返回一个数值,这个数值表达式就被调用了。

同样地,相同的句法可以用在列表控件之外。

这主要包括在页面上显示数值或者是控件的属性值。

Container.DataItem是专门为DataItem绑定到特殊项上专门设置的控件。

它指向数据源处的一个数据项目如表中的一个数据行或者是列表中的某个元素的值。

DataItem的实际的数据类型是由数据源确定的。

因此,如果你处理一个整型数组,DataItem的数据类型则是整型。

下面的表达式是用来调用在各种情况下Container.DataItem的调用情况,让我们来快速的回顾下。

< %# Container.DataItem % > --串价值的一个阵列被返回。

< %# Container.DataItem (“表达”) % > --从一个DataView容器的具体的值被返回。

< %# Container.DataItem.PropertyName % > --数据源的具体的串值被返回。

< %# CStr ( Container.DataItem.PropertyName ) % > --用被改变的一数值覆盖其串值表达式值。

当你使用C#时,句法是有点不同的。

下列表达式则在原先的列基础上每行再加上相应的C#代码。

注意到基本的句法同样,但是当数值被返回和返回值被改变成为适当的数据类型时,它就发生变化了。

< %# Container.DataItem % >
< %# ( ( DataRowView ) Container.DataItem )["PropertyName" ] % >
< %# ( ( ObjectType ) Container.DataItem ).PropertyName % >
< %# ( ( ObjectType ) Container.DataItem ).PropertyName.ToString ( ) % >
句法是与当页面的属性和方法一致的被。

当串值被返回时,语法结构仍然保持不变。

如下则是提供了一些例子:
< %# propertyName % > --一页面属性值被返回。

< asp:ListBox id="lstValues”datasource='<%# propertyName %>的runat="server" > --从页面取回的数值(数组,对象集)绑定倒数据控件上。

< %# ( objectName.PropertyName ) % > --页实例属性值被显示。

< %# MethodName( ) % > --调用方法时返回的值显示。

你能在Page页上使用如下句法使用特殊的的数值( 属性值,方法返回值,等等):
< %=数值% >
在列表A中的C#代码是用技术实现的数据捆绑。

它从SQL服务器Northwind 雇员表中选择雇员名称和电话号码。

查询的数值是通过转发器来控制显示的。

列表数值通过数据捆绑的技术被插入,而Form的页面数值是通过使用方法调用来实现数值的传递。

此外,DataItem的ItemIndex属性用来显示一数字。

ItemIndex属性从零开始,因此一但有数值显示,它就自动的+1
列表B包含相等的代码。

主要的区别在于在C#中应用了括号。

然而,这不是 的必须执行的。

当意识到使用时必须知道数据类型并且要随着应用而发生改变时,就会觉得使用Contain.DataItem变得有些麻烦,不是很方便。

因此微软对DataBinder类作了改进,使它的应用变得相对要简单些。

在系统运行时,微软文件(在MSDN上)申明在DataBinder类中将数据绑定表达式的值的数据类型强制转换成实例的数值类型。

在Visual Studio .NET中,这方法让RAD 设计者很容易对数据捆绑的句法作语法分析。

这方法也能通过申明将一个Web的页面类型很简单的转换成为另一种类型。

当在页面中使用数据值时,DataBinder类的Eval方法能起着举足轻重的作用。

Eval方法接受以前覆盖的Container.DataItem对象;它根据情况改变,根据表达式推算出字段的具体细节并且将它显示出来。

它有如下句法:
DataBinder.Eval ( Container.DataItem,“字段名”,“格式化选项”)
使用这种句法结构,列表C.列表D中看起来象C#代码,就能像使用DataBinder.Eval重写第一个包含相同结构的代码例子。

DataBinder.Eval方法应用到系统中时,功能是很强的。

但同时,当时间和资源随着系统调用元素项并决定调用返回数据类型而慢慢耗尽时,就必须谨慎的使用。

大量的选择
数据捆绑使得调用页面相关数据是变得非常的简单。

这里可提供各种各样的数据捆绑的选择,包括:捆绑数据到控件上和允许它决定让它如何显示,或者选择在页中用申明的形式将数据绑定到控件上。

但最后,还是根据具体的情况去使用它。

相关文档
最新文档