All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL,Server,2005—有关开发的10个最重要的特点_[SQL,Server教程]
SQL大全[2]_mssql学习_编程技术
用于GridView自定义分页的几种存储过程写法_[Asp.Net教程]
小议优化ASP.NET应用性能之Cache篇_[Asp.Net教程]
AJAX的jQuery实现入门(一)_[AJAX教程]
asp.net,URL重写(URLRewriter),之简化版_[Asp.Net教程]
javascript应用实例:网页折叠菜单_JavaScript技术_编程技术
Visual,Studio,2008,Professional,简体中文RTM版,体验(1)_[Asp.Net教程]
解决SQL Server常见的七个经典问题_[SQL Server教程]
数据类型的表达式转换为另一种数据类型_[SQL Server教程]
Reading number is top 10 pictures
身材野火台灣美女1
运动的范冰冰1
星星命名法则
穷哥们向美女求婚攻略
含苞欲放的素颜美少女1
NeedWallpaper2
I also want to live a June 1 children's day, dad
A letter to parents choose world of warcraft seven big reason
Average female college students3
Ashlynn Brooke show proud chest measurement1
Download software ranking
WebService在.NET中的实战应用教学视频 → 第5集
尖东毒玫瑰A
美女游泳记
Dance with duck(male prostitution)
Sora aoi 120 minutes
apache-tomcat-6.0.33
Eclipse-CALMSANNY (second edition)
Boxer vs Yellow1
Boxer's Top ten classic battle3
ASP.NET.2.0.XML.高级编程(第3版)
aaa published in(发表于) 2013/12/6 10:16:45 Edit(编辑)
ADO.NET2.0跟ADO.NET3.0的一些新特性简要介绍_.net资料_编程技术

ADO.NET2.0跟ADO.NET3.0的一些新特性简要介绍_.net资料_编程技术-数科优化网

ADO.NET2.0跟ADO.NET3.0的一些新特性简要介绍_.net资料_编程技术-数科优化网

觉得很多人在写关于ASP.NET2.0的东东,很少有人写关于ADO.NET2.0的新特性。查找了一下MSDN,给大家介绍几点好了。(如果需要察看所有ADO.NET2.0的新特性,请查看


http://msdn2.microsoft.com/en-us/library/ex6y04yf.aspx


Server Enumeration


用来枚举活动状态的SQL Server实例,版本需要在SQL2000及更新版本。使用的是SqlDataSourceEnumerator类


可以参考以下示例代码:


using System.Data.Sql;


class Program
{
static void Main()
{
// Retrieve the enumerator instance and then the data.
SqlDataSourceEnumerator instance =
SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();


// Display the contents of the table.
DisplayData(table);


Console.WriteLine("Press any key to continue.");
Console.ReadKey();
}


private static void DisplayData(System.Data.DataTable table)
{
foreach (System.Data.DataRow row in table.Rows)
{
foreach (System.Data.DataColumn col in table.Columns)
{
Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);
}
Console.WriteLine("============================");
}
}
}


DataSet Enhancements


新的DataTableReader类可以说是一个DataSet或者DataTable,的一个或者多个的read-only, forward-only的结果集。需要说明的是,DataTable返回的DataTableReader不包含被标记为deleted的行。


示例:


private static void TestCreateDataReader(DataTable dt)
{
// Given a DataTable, retrieve a DataTableReader
// allowing access to all the tables' data:
using (DataTableReader reader = dt.CreateDataReader())
{
do
{
if (!reader.HasRows)
{
Console.WriteLine("Empty DataTableReader");
}
else
{
PrintColumns(reader);
}
Console.WriteLine("========================");
} while (reader.NextResult());
}
}


private static DataTable GetCustomers()
{
// Create sample Customers table, in order
// to demonstrate the behavior of the DataTableReader.
DataTable table = new DataTable();


// Create two columns, ID and Name.
DataColumn idColumn = table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name", typeof(string));


// Set the ID column as the primary key column.
table.PrimaryKey = new DataColumn[] { idColumn };


table.Rows.Add(new object[] { 1, "Mary" });
table.Rows.Add(new object[] { 2, "Andy" });
table.Rows.Add(new object[] { 3, "Peter" });
table.Rows.Add(new object[] { 4, "Russ" });
return table;
}


private static void PrintColumns(DataTableReader reader)
{
// Loop through all the rows in the DataTableReader
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
Console.Write(reader[i] + " ");
}
Console.WriteLine();
}
}


Binary Serialization for the DataSet


关于这点linkcd已经写过一篇性能测试的文章:.Net 2.0 下Data Container性能比较: Binary Serialize Dataset vs Custom Classes


DataTable as a Stand-Alone Object


很多以前DataSet的方法,现在可以用DataTable直接使用了


Create a DataTable from a DataView


现在可以从DataView返回一个DataTable了,两者基本是一样的,当然你也可以有选择性的返回,比如说返回distinct rows


New DataTable Loading Capabilities


DataTables跟DataSets现在提供一个新的Load方法,可以直接把DataReader中的数据流载入到DataTable中,当然你也可以对如何Load做一些选择。

以上是ADO.NET2.0的一些特性,你使用.NET2.0进行开发,就可以使用这些特性。


更激动人心的在于ADO.NET3.0的一些特性.


有文章介绍了一些ADO.NET3.0 AUGUT CTP的一些特性:


The ADO.NET Entity Framework


The Entity Data Model (EDM),实体数据模型,开发者可以以更高的抽象层次来设计数据模型
一个很牛的client-views/mapping引擎,用来映射(map to and form)存储结构(store schemas )
完全支持使用Entity SQL跟LINQ( 这东西现在出现频率还挺高的哦,也挺好玩的一个东东)查询EDM schemas
.....
LINQ(AUGUST CTP):


LINQ to Entities: 使用LINQ查询EDM schemas
LINQ to DataSet: 对一个或者多个DataTable进行LINQ查询
都是很期待的技术,Enjoy it!:)






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.