av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

LINQtoDataSet詳細(xì)概括

學(xué)習(xí)LINQ時(shí),經(jīng)常會遇到LINQ to DataSet問題,這里將介紹LINQ to DataSet問題的解決方法。

使用 LINQ to DataSet 可以更快更容易地查詢在 DataSet 對象中緩存的數(shù)據(jù)。具體而言,通過使開發(fā)人員能夠使用編程語言本身而不是通過使用單獨(dú)的查詢語言來編寫查詢,LINQ to DataSet 可以簡化查詢。對于現(xiàn)在可以在其查詢中利用 Visual Studio 所提供的編譯時(shí)語法檢查、靜態(tài)類型和 IntelliSense 支持的 Visual Studio 開發(fā)人員,這特別有用。

LINQ to DataSet 也可用于查詢從一個(gè)或多個(gè)數(shù)據(jù)源合并的數(shù)據(jù)。這可以使許多需要靈活表示和處理數(shù)據(jù)的方案(例如查詢本地聚合的數(shù)據(jù)和 Web 應(yīng)用程序中的中間層緩存)能夠?qū)崿F(xiàn)。具體地說,一般報(bào)告、分析和業(yè)務(wù)智能應(yīng)用程序?qū)⑿枰@種操作方法。

LINQ to DataSet 功能主要通過 DataRowExtensions 和 DataTableExtensions 類中的擴(kuò)展方法公開。LINQ to DataSet 基于并使用現(xiàn)有的 ADO.NET 2.0 體系結(jié)構(gòu)生成,在應(yīng)用程序代碼中不能替換 ADO.NET 2.0。現(xiàn)有的 ADO.NET 2.0 代碼將繼續(xù)在 LINQ to DataSet 應(yīng)用程序中有效。

下面看一個(gè)例子:

 
 
 
  1. // Fill the DataSet.
  2. DataSet ds = new DataSet();
  3. ds.Locale = CultureInfo.InvariantCulture
  4. FillDataSet(ds); 
  5. DataTable products = ds.Tables["Product"]; 
  6. var query =
  7. from product in products.AsEnumerable()
  8. where !product.IsNull("Color") &&
  9. (string)product["Color"] == "Red"
  10. select new
  11. {
  12. Name = product["Name"],
  13. ProductNumber = product["ProductNumber"],
  14. ListPrice = product["ListPrice"]
  15. }; 
  16. foreach (var product in query)
  17. {
  18. Console.WriteLine("Name: {0}", product.Name);
  19. Console.WriteLine("Product number: {0}", product.ProductNumber);
  20. Console.WriteLine("List price: ${0}", product.ListPrice);
  21. Console.WriteLine("");
  22. }

使用擴(kuò)展之后的例子:

 
 
 
  1. // Fill the DataSet.
  2. DataSet ds = new DataSet();
  3. ds.Locale = CultureInfo.InvariantCulture;
  4. FillDataSet(ds);
  5. DataTable products = ds.Tables["Product"];
  6. var query =
  7. from product in products.AsEnumerable()
  8. where product.Field("Color") == "Red"
  9. select new
  10. {
  11. Name = product.Field("Name"),
  12. ProductNumber = product.Field("ProductNumber"),
  13. ListPrice = product.Field("ListPrice")
  14. };
  15. foreach (var product in query)
  16. {
  17. Console.WriteLine("Name: {0}", product.Name);
  18. Console.WriteLine("Product number: {0}", product.ProductNumber);
  19. Console.WriteLine("List price: ${0}", product.ListPrice);
  20. Console.WriteLine("");
  21. }

當(dāng)前題目:LINQtoDataSet詳細(xì)概括
分享鏈接:http://uogjgqi.cn/article/dpcpdos.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們在微信上24小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流