2023年全國(guó)碩士研究生考試考研英語(yǔ)一試題真題(含答案詳解+作文范文)_第1頁(yè)
已閱讀1頁(yè),還剩11頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、<p><b>  英文一原文:</b></p><p>  ADO. Net Technology</p><p>  ADO. NET is designed for solving the Web and program problem about the distribution application by Microsoft. As a kin

2、d 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

3、 gotten extensive application. This paper discusses for this. </p><p>  I.The major object of ADO.NET.</p><p>  Many objects in ADO.Net is similar to the object function in ADO , but the functi

4、on of the object in ADO.NET 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,

5、DataAdapter, DataReader and DataSetCommand etc..It make more simple to operate the database. </p><p>  I.a DataSet object: DataSet is the core of ADO.NET, is specially used to handle the data which is read

6、 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

7、 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. Genera</p><p>  I.b DataReader objec

8、t: When looking over mass data with the way that glanced over , it will occupy plenty of memories and cause performance to drop. </p><p>  For instance,when a link (Connection ) reads the record of 1000 line

9、s 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 o

10、peration 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 on</p&g

11、t;<p>  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 da

12、ta 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 inquirin

13、g string when design the database .ADO. NET offer the way that has elastici</p><p>  I.d DataAdapter object: ADO. NET establish and initialize data sheet through DataAdapter, so as to keep the data in the m

14、emory 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 ob

15、ject.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. </p><p>  II.Visit Database in joining </p><p>  

16、II.a The analysis of a example which visit the database of SQL SERVER in ADO.Net technology</p><p>  [ abstract ] With the thorough that applied along with distributed database, permanent database connection

17、 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 ADO.NET, and analyse the course

18、 of visiting SQL SERVER furtherly. </p><p>  [ keyword ] ADO. NET visit XML independently </p><p>  Drawing the bottom graph of the map, add new picture layer according to the fuction of defined

19、 , Setting picture layer visibility and so on: </p><p>  / / constructs function </p><p>  function FlashMap ( width: Number, height: Number, Geo_x: Number, Geo_y: Number ) { layersCount = 0; &l

20、t;/p><p>  layers=new Array();</p><p>  stageWidth=width;</p><p>  stageHeight=height;</p><p><b>  x=Geo_x;</b></p><p><b>  y=Geo_y;</b&g

21、t;</p><p>  Map_mc=_root.createEmptyMovieClip("Map_mc",0);</p><p>  Map_mc.createEmptyMovieClip("Map_mc",-200);</p><p><b>  }</b></p><p>

22、;  //create object </p><p>  Map = new FlashMap( stagewidth, stagehight, Mapx, Mapy); </p><p>  //Loading map </p><p>  function initMap () { Map. drawMap ();} </p><p>

23、  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 ca

24、n 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. </p>

25、<p>  The code of the script of mouse option:</p><p>  Function select ( ) </p><p>  { var selectedRegion: Array; </p><p>  selectedRegion=new Array();</p><p>  

26、for(j=0;j<Map.layersCount;</p><p>  j++){var coverLayer:MapLayer=Map.layers [j];</p><p>  for(i=0;i<converLayer.Regions_ary.length;</p><p>  i++){var Region:MapRegion=MapRegio

27、n(coverLayer.Regions_ary [i]);</p><p>  if(Region.isInRegion(_root._xmouse,_root._ymouse)){selectedRegion.push(coverLayer);</p><p>  selectedRegion.push(Region);</p><p><b>  }

28、 </b></p><p><b>  }</b></p><p><b>  } </b></p><p>  III. The practice of concluding remarks proves , in database the campus geography information that

29、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

30、 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 metho</p><p><b>  中文一

31、譯文:</b></p><p><b>  ADO.Net技術(shù)</b></p><p>  ADO.NET 是Microsoft 為解決Web 和分布式應(yīng)用程序問(wèn)題而設(shè)計(jì)的。作為一種數(shù)據(jù)庫(kù)訪問(wèn)框架, ADO.NET 能處理當(dāng)今N 層的Web應(yīng)用程序所要求的非連接數(shù)據(jù)體系結(jié)構(gòu), 因而在訪問(wèn)SQL SERVER數(shù)據(jù)庫(kù)時(shí), 性能優(yōu)越, 得到了廣泛應(yīng)用。本文對(duì)此進(jìn)

32、行了討論。</p><p>  一、ADO.NET 的主要對(duì)象</p><p>  ADO.NET 中有很多對(duì)象與ADO 中的對(duì)象功能相似, 但ADO.NET 中對(duì)象的功能更強(qiáng)大。同時(shí), 除Connection、Parameter、Command對(duì)象外ADO.NET 還添加了許多新的對(duì)象和程序化接口, 如DataSet 、DataView、DataAdapter、DataReader、Da

33、taSetCommand 等,</p><p>  使得對(duì)數(shù)據(jù)庫(kù)的操作更簡(jiǎn)單。</p><p>  1、DataSet 對(duì)象: DataSet 是ADO.NET 的核心, 是專(zhuān)門(mén)用來(lái)處理從數(shù)據(jù)存儲(chǔ)中讀出的數(shù)據(jù), 并以離線方式存在于本地內(nèi)存中??梢允褂孟嗤姆绞絹?lái)操作從不同數(shù)據(jù)來(lái)源取得的數(shù)據(jù), 不管底層的數(shù)據(jù)庫(kù)是SQL Server 還是Oracle, DataSet 的行為都是一致的。在D

34、ataSet 中可以包含任意數(shù)量的DataTable, 且每個(gè)DataTable 對(duì)應(yīng)一個(gè)數(shù)據(jù)庫(kù)的Table 或View。一般來(lái)說(shuō), 一個(gè)對(duì)應(yīng)DataTable 對(duì)象的數(shù)據(jù)表就是一組DataRow 與DataColumn 的集合。DataTable 會(huì)負(fù)責(zé)維護(hù)每一筆數(shù)據(jù)行保留它的初始狀態(tài)和當(dāng)前的狀態(tài), 以解決數(shù)據(jù)庫(kù)的</p><p>  并發(fā)訪問(wèn)問(wèn)題。ADO.NET 的離線連接模式減少了對(duì)數(shù)據(jù)服務(wù)器的壓力。<

35、;/p><p>  2、DataReader 對(duì)象: 當(dāng)以瀏覽的方式查看大量數(shù)據(jù)的時(shí)候,會(huì)占用大量?jī)?nèi)存, 導(dǎo)致性能下降。例如, 一個(gè)鏈接(Connection) 用傳統(tǒng)的ADO Recordset 對(duì)象去讀1000 行數(shù)據(jù)庫(kù)的記錄, 則必須為這1000 行記錄將內(nèi)存分配給這個(gè)鏈接直至這個(gè)鏈接的生命周期結(jié)束。如果有多個(gè)用戶(hù)在同一時(shí)間對(duì)同一計(jì)算機(jī)進(jìn)行同樣的操作, 則機(jī)器內(nèi)存將被過(guò)度使用。為了解決這些問(wèn)題, DotNET

36、框架提供了DataReader 對(duì)象, 從數(shù)據(jù)庫(kù)返回一個(gè)只讀的、僅能向下滾動(dòng)的串流(Strem), 而且當(dāng)前內(nèi)存中每次僅存在一條記錄。</p><p>  3、DataView 對(duì)象: DataView 對(duì)象代表一個(gè)DataTable 的數(shù)據(jù)查看方式, 數(shù)據(jù)默認(rèn)的查看方式是將數(shù)據(jù)以表格的形式排列, 且數(shù)據(jù)排列的順序遵循從數(shù)據(jù)庫(kù)數(shù)據(jù)表中取出數(shù)據(jù)時(shí)行排列的順序, 通常和設(shè)計(jì)數(shù)據(jù)庫(kù)時(shí)的Sort Order 或在查詢(xún)字符

37、串中指明排序的欄位、</p><p>  升降冪有關(guān)。ADO.NET 提供非常有彈性的方式以供用戶(hù)利用排序、條件過(guò)濾、查找等特性來(lái)定義不同的查看方式,從而編輯、瀏覽數(shù)據(jù)或顯示DataTable 中的數(shù)據(jù)。例如, 可以建立一個(gè)DataView對(duì)象,然后指定和以缺省的查看(DefaultView) 不同的排序方式, 或者也</p><p>  可以使用條件過(guò)濾(Filter) 只查看數(shù)據(jù)表中的

38、部分?jǐn)?shù)據(jù)。這種方式,可以將兩個(gè)以上的控制項(xiàng)綁定到同一個(gè)數(shù)據(jù)表, 但顯示的是不同的數(shù)據(jù)。</p><p>  4、DataAdapter 對(duì)象: ADO.NET 通過(guò)DataAdapter 對(duì)象建立、初始化數(shù)據(jù)表, 從而和DataSet 對(duì)象結(jié)合起來(lái)在內(nèi)存中存放數(shù)據(jù)。DataAdapter 對(duì)象能隱藏和Connection、Command 對(duì)象溝通的細(xì)節(jié)。DataAdapter 對(duì)象允許將DataSet 對(duì)象中的數(shù)

39、據(jù)保存到數(shù)據(jù)來(lái)源(DataSource) , 也可以從數(shù)據(jù)來(lái)源取出數(shù)據(jù)。同理, 也可以對(duì)底層數(shù)據(jù)保存體進(jìn)行數(shù)據(jù)的添加、刪除或修改操作。</p><p><b>  二、數(shù)據(jù)庫(kù)連接訪問(wèn)</b></p><p>  ADO.NET 訪問(wèn)SQL SERVER數(shù)據(jù)庫(kù)的實(shí)例分析</p><p>  [ 摘要] 隨著分布式數(shù)據(jù)庫(kù)應(yīng)用的深入, 永久的數(shù)據(jù)庫(kù)聯(lián)

40、接是相當(dāng)耗費(fèi)資源的。在訪問(wèn)SQL SERVER數(shù)據(jù)庫(kù)中, 采用ADO.NET 技術(shù)可以完美地解決這個(gè)問(wèn)題。本文討論了ADO.NET 的主要對(duì)象, 并深入分析了其訪問(wèn)SQL SERVER 的過(guò)程。</p><p>  [ 關(guān)鍵字] ADO.NET 獨(dú)立訪問(wèn)XML</p><p>  據(jù)其定義的函數(shù)繪制地圖底層圖形、添加新圖層, 設(shè)置圖層的可見(jiàn)性等等:</p><p>

41、<b>  //構(gòu)造函數(shù)</b></p><p>  function FlashMap (width:Number, height:Number,Geo_x:Number,</p><p>  Geo_y:Number) {</p><p>  layersCount = 0;</p><p>  layers = n

42、ew Array () ;</p><p>  stageWidth = width;</p><p>  stageHeight = height;</p><p>  x = Geo_x;</p><p>  y = Geo_y;</p><p>  Map_mc=_root.createEmptyMovieCli

43、p (" Map_mc" ,0) ;</p><p>  Map_mc.createEmptyMovieClip (" Map_mc" ,- 200) ;</p><p><b>  }</b></p><p><b>  //創(chuàng)建實(shí)例</b></p><p>

44、;  Map = new FlashMap (stagewidth, stagehight, Mapx, Mapy) ;</p><p><b>  //裝載地圖</b></p><p>  function initMap () {</p><p>  Map.drawMap () ;</p><p><b>

45、;  }</b></p><p>  2.4 地圖數(shù)據(jù)的信息查詢(xún): 對(duì)于flash 上加載的地圖各圖層的點(diǎn)、線、面數(shù)據(jù)的查詢(xún)主要是鼠標(biāo)的點(diǎn)選和框選來(lái)實(shí)現(xiàn)的, 通過(guò)查詢(xún)當(dāng)前圖層中是否有實(shí)體對(duì)象數(shù)據(jù)包含在鼠標(biāo)選擇范圍內(nèi), 若存在則返回簡(jiǎn)單查詢(xún)結(jié)果在新窗口中顯示給用戶(hù)。鼠標(biāo)選擇的腳本代碼為:</p><p>  function select () {</p><

46、p>  var selectedRegion:Array;</p><p>  selectedRegion=new Array () ;</p><p>  for (j=0; j<Map.layersCount; j++) { </p><p>  var coverLayer:MapLayer = Map.layers [j] ;</p>

47、;<p>  for (i=0; i<converLayer.Regions_ary.length; i++) {</p><p>  var Region:MapRegion = MapRegion ( coverLayer.Regions_</p><p>  ary [i]) ;</p><p>  if ( Region.isInRegi

48、on ( _root._xmouse, _root._ymouse) )</p><p><b>  {</b></p><p>  selectedRegion.push (coverLayer) ;</p><p>  selectedRegion.push (Region) ;</p><p><b> 

49、 }</b></p><p><b>  }</b></p><p><b>  }</b></p><p><b>  3.結(jié)束語(yǔ)</b></p><p>  實(shí)踐證明, 在數(shù)據(jù)庫(kù)要求不高、動(dòng)態(tài)數(shù)據(jù)較少的校園地理信息展示方面, 這是一種切實(shí)可行、開(kāi)發(fā)容易、成本低廉

50、的方法。此外,采用這種方法制作完成的網(wǎng)絡(luò)電子地圖色彩豐富, 內(nèi)容多樣, 如果把虛擬現(xiàn)實(shí)技術(shù)與這種制作方法的網(wǎng)絡(luò)電子地圖結(jié)合起來(lái), 就可以實(shí)現(xiàn)校園地理環(huán)境的平面漫游和空間漫游。這種網(wǎng)絡(luò)電子地圖的展示效果是傳統(tǒng)GIS 軟件很難達(dá)到的, 在校園地理位置展示和建筑小區(qū)展示等領(lǐng)域這種方法具有較大的發(fā)展?jié)摿Α?lt;/p><p><b>  英文二原文</b></p><p>  T

51、he Data Binding Technology</p><p>  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

52、 together.</p><p>  If you are familiar with classic ASP, the declarative data binding syntax introduced in ASP.NET will be familiar to you even though the functionality is vastly different. Data binding exp

53、ressions 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 expo

54、sed by the page. While this feature is easy to use, it often causes some confusion about what is al</p><p>  Data binding basics</p><p>  Data binding expressions link ASP.NET page properties, s

55、erver 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 anyw

56、here in the page. All data binding expressions, regardless of where you place them, must be contained between <%# and %> characters.</p><p>  When used with data controls (like Repeater, DataGrid, and

57、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. Th

58、is includes displaying values on the page or populating control attributes.</p><p>  Container.DataItem is a runtime alias for the DataItem bound to a specific item. It maps to an individual item from the da

59、ta 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 DataIt

60、em will be an integer.</p><p>  The following list provides a quick review of the VB.NET syntax for various scenarios:</p><p>  <%# Container.DataItem %>--An array of string values is retu

61、rned. </p><p>  <%# Container.DataItem("expression") %>--The specific field from a DataView container is returned. </p><p>  <%# Container.DataItem.PropertyName %>--The spe

62、cific string property value of data source is returned. </p><p>  <%# CStr(Container.DataItem.PropertyName) %>--Returns a property value converted to its string representation. </p><p>  W

63、hen 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 a

64、re returned and converted to the appropriate data type.</p><p>  <%# Container.DataItem %> </p><p>  <%# ((DataRowView)Container.DataItem)["PropertyName"] %> </p>&l

65、t;p>  <%# ((ObjectType)Container.DataItem).PropertyName %> </p><p>  <%# ((ObjectType)Container.DataItem).PropertyName.ToString() %> </p><p>  Syntax is consistent when working wi

66、th page level properties and methods. The syntax remains the same as long as string values are returned. The following list provides some examples:</p><p>  <%# propertyName %>--The value for a page le

67、vel property is returned. </p><p>  <asp:ListBox id="lstValues" datasource='<%# propertyName %>' runat="server">--The value retrieved from the page level property (arr

68、ay, collection of objects, etc.) is bound to the data control. </p><p>  <%# (objectName.PropertyName) %>--The value of the page level object property is displayed. </p><p>  <%# Method

69、Name() %>--The value returned from the page method is displayed. </p><p>  You may use individual values (albeit properties, method return values, and so forth) on a page using the following syntax:</p

70、><p>  <%= Value %></p><p>  The C# code in Listing A demonstrates data binding in an ASP.NET Web form. It selects employee names and telephone numbers from the SQL Server Northwind Employees

71、 table. The values from the query are displayed via an ASP.NET 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 ItemInd

72、ex property of the DataItem is used to display a row number. The ItemIndex property begins with zero, so one is added befo</p><p>  Listing B contains the equivalent VB.NET code. The main difference is the u

73、se of parentheses as opposed to brackets in C#. Also, the casting of the rows is not necessary with VB.NET.</p><p>  Using the Contain.DataItem object can be tedious, since you must be aware of the data type

74、 and convert it accordingly for use. Microsoft does provide the DataBinder class to further simplify development.</p><p>  Microsoft documentation (on MSDN) states the DataBinder class uses reflection to par

75、se 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 declara

76、tively on a Web form's page to simplify casting from one type to another.</p><p>  You can use the Eval method of the DataBinder class to make .NET do the heavy lifting when using data values in an ASP.N

77、ET 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 synta

78、x:</p><p>  DataBinder.Eval(Container.DataItem, "field name", "optional formatting")</p><p>  Using this syntax, you could rewrite the first example to use DataBinder.Eval to

79、 look like the C# code in Listing C. Listing D contains the equivalent VB.NET code.</p><p>  The DataBinder.Eval approach is great as it pushes work to the system. On the other hand, you should use it with c

80、aution, since time and resources are consumed as the system locates the element and determines its object/data type.</p><p>  Plenty of options</p><p>  Data binding makes it relatively simple t

81、o include data in ASP.NET 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 contr

82、ol presentation within the ASP.NET page. In the end, it comes down to your preference, but it is great to have options.</p><p><b>  中文一譯文:</b></p><p><b>  數(shù)據(jù)捆綁技術(shù)</b></

83、p><p>  在我的項(xiàng)目中,我需要從數(shù)據(jù)庫(kù)顯示數(shù)據(jù),因此我使用數(shù)據(jù)捆綁的技術(shù) 它是由微軟公司支持的。如下,我們一起來(lái)談?wù)撍?lt;/p><p>  如果你熟悉經(jīng)典ASP,在ASP.NET介紹申明數(shù)據(jù)捆綁的句法與它在功能是有很大的不同。 數(shù)據(jù)捆綁的表達(dá)方式:就是能在ASPX文件中以在此形式(< %#和% >)之間出現(xiàn)的代碼。 這種表達(dá)方式允許你把控件很容易地綁定到數(shù)據(jù)源,連同屬性,語(yǔ)

84、法,結(jié)果值同時(shí)在方法調(diào)用時(shí)在頁(yè)面中顯示。 當(dāng)這些特性輕松的被使用時(shí),由于它是否被允許能夠被調(diào)用而經(jīng)常造成一些的混亂。</p><p>  數(shù)據(jù)捆綁的基本原則:</p><p>  當(dāng)DataBind方法被調(diào)用時(shí),數(shù)據(jù)就捆綁到ASP.NET的控件屬性,數(shù)據(jù)源。 數(shù)據(jù)表達(dá)式可以放置在頁(yè)面的任何一處,或置于服務(wù)器控件成對(duì)標(biāo)簽的之間的附值處。 所有數(shù)據(jù)捆綁的表達(dá)式,不論是將它們放置在哪,都必須包含

85、在< %#和% >標(biāo)志之間。</p><p>  當(dāng)數(shù)據(jù)控件(像轉(zhuǎn)發(fā)器一樣,DataGrid,如此等等)綁定時(shí),表達(dá)參數(shù)通常是數(shù)據(jù)源的一張表的一個(gè)列名。盡管如此,只要返回一個(gè)數(shù)值,這個(gè)數(shù)值表達(dá)式就被調(diào)用了。 同樣地,相同的句法可以用在列表控件之外。 這主要包括在頁(yè)面上顯示數(shù)值或者是控件的屬性值。</p><p>  Container.DataItem是專(zhuān)門(mén)為DataItem綁

86、定到特殊項(xiàng)上專(zhuān)門(mén)設(shè)置的控件。它指向數(shù)據(jù)源處的一個(gè)數(shù)據(jù)項(xiàng)目如表中的一個(gè)數(shù)據(jù)行或者是列表中的某個(gè)元素的值。 DataItem的實(shí)際的數(shù)據(jù)類(lèi)型是由數(shù)據(jù)源確定的。 因此,如果你處理一個(gè)整型數(shù)組,DataItem的數(shù)據(jù)類(lèi)型則是整型。</p><p>  下面的表達(dá)式是用VB.Net來(lái)調(diào)用在各種情況下Container.DataItem的調(diào)用情況,讓我們來(lái)快速的回顧下。</p><p>  <

87、%# Container.DataItem % > --串價(jià)值的一個(gè)陣列被返回。 </p><p>  < %# Container.DataItem (“表達(dá)”) % > --從一個(gè)DataView容器的具體的值被返回。 </p><p>  < %# Container.DataItem.PropertyName % > --數(shù)據(jù)源的具體的串值被返回。 &

88、lt;/p><p>  < %# CStr ( Container.DataItem.PropertyName ) % > --用被改變的一數(shù)值覆蓋其串值表達(dá)式值。 </p><p>  當(dāng)你使用C#時(shí),句法是有點(diǎn)不同的。 下列表達(dá)式則在原先的列基礎(chǔ)上每行再加上相應(yīng)的C#代碼。 注意到基本的句法同樣,但是當(dāng)數(shù)值被返回和返回值被改變成為適當(dāng)?shù)臄?shù)據(jù)類(lèi)型時(shí),它就發(fā)生變化了。</p&

89、gt;<p>  < %# Container.DataItem % ></p><p>  < %# ( ( DataRowView ) Container.DataItem )["PropertyName" ] % ></p><p>  < %# ( ( ObjectType ) Container.DataItem )

90、.PropertyName % ></p><p>  < %# ( ( ObjectType ) Container.DataItem ).PropertyName.ToString ( ) % ></p><p>  句法是與當(dāng)頁(yè)面的屬性和方法一致的被。當(dāng)串值被返回時(shí),語(yǔ)法結(jié)構(gòu)仍然保持不變。 如下則是提供了一些例子:</p><p>  <

91、; %# propertyName % > --一頁(yè)面屬性值被返回。 </p><p>  < asp:ListBox id="lstValues”datasource='<%# propertyName %>的runat="server" > --從頁(yè)面取回的數(shù)值(數(shù)組,對(duì)象集)綁定倒數(shù)據(jù)控件上。 </p><p>  

92、< %# ( objectName.PropertyName ) % > --頁(yè)實(shí)例屬性值被顯示。 </p><p>  < %# MethodName( ) % > --調(diào)用方法時(shí)返回的值顯示。 </p><p>  你能在Page頁(yè)上使用如下句法使用特殊的的數(shù)值( 屬性值,方法返回值,等等):</p><p><b>  <

93、; %=數(shù)值% ></b></p><p>  在列表A中的C#代碼是用ASP.NET技術(shù)實(shí)現(xiàn)的數(shù)據(jù)捆綁。 它從SQL服務(wù)器Northwind雇員表中選擇雇員名稱(chēng)和電話號(hào)碼。 查詢(xún)的數(shù)值是通過(guò)ASP.NET轉(zhuǎn)發(fā)器來(lái)控制顯示的。 列表數(shù)值通過(guò)數(shù)據(jù)捆綁的技術(shù)被插入,而Form的頁(yè)面數(shù)值是通過(guò)使用方法調(diào)用來(lái)實(shí)現(xiàn)數(shù)值的傳遞。此外,DataItem的ItemIndex屬性用來(lái)顯示一數(shù)字。ItemIndex

94、屬性從零開(kāi)始,因此一但有數(shù)值顯示,它就自動(dòng)的+1</p><p>  列表B包含相等的VB.NET代碼。 主要的區(qū)別在于在C#中應(yīng)用了括號(hào)。然而,這不是VB.NET的必須執(zhí)行的。</p><p>  當(dāng)意識(shí)到使用時(shí)必須知道數(shù)據(jù)類(lèi)型并且要隨著應(yīng)用而發(fā)生改變時(shí),就會(huì)覺(jué)得使用Contain.DataItem變得有些麻煩,不是很方便。因此微軟對(duì)DataBinder類(lèi)作了改進(jìn),使它的應(yīng)用變得相對(duì)要簡(jiǎn)

95、單些。</p><p>  在系統(tǒng)運(yùn)行時(shí),微軟文件(在MSDN上)申明在DataBinder類(lèi)中將數(shù)據(jù)綁定表達(dá)式的值的數(shù)據(jù)類(lèi)型強(qiáng)制轉(zhuǎn)換成實(shí)例的數(shù)值類(lèi)型。在Visual Studio .NET中,這方法讓RAD設(shè)計(jì)者很容易對(duì)數(shù)據(jù)捆綁的句法作語(yǔ)法分析。 這方法也能通過(guò)申明將一個(gè)Web的頁(yè)面類(lèi)型很簡(jiǎn)單的轉(zhuǎn)換成為另一種類(lèi)型。</p><p>  當(dāng)在頁(yè)面中使用數(shù)據(jù)值時(shí),DataBinder類(lèi)的Ev

96、al方法能起著舉足輕重的作用。 Eval方法接受以前覆蓋的Container.DataItem對(duì)象; 它根據(jù)情況改變,根據(jù)表達(dá)式推算出字段的具體細(xì)節(jié)并且將它顯示出來(lái)。它有如下句法:</p><p>  DataBinder.Eval ( Container.DataItem,“字段名”,“格式化選項(xiàng)”)</p><p>  使用這種句法結(jié)構(gòu),列表C.列表D中看起來(lái)象C#代碼,就能像使用Da

97、taBinder.Eval重寫(xiě)第一個(gè)包含相同結(jié)構(gòu)的VB.NET代碼例子。</p><p>  DataBinder.Eval方法應(yīng)用到系統(tǒng)中時(shí),功能是很強(qiáng)的。 但同時(shí),當(dāng)時(shí)間和資源隨著系統(tǒng)調(diào)用元素項(xiàng)并決定調(diào)用返回?cái)?shù)據(jù)類(lèi)型而慢慢耗盡時(shí),就必須謹(jǐn)慎的使用。</p><p><b>  大量的選擇</b></p><p>  數(shù)據(jù)捆綁使得調(diào)用ASP.

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論