2012年3月5日

重视Linq技术_7

摘要: Projecting - Select//1、Select-Subqueries and Object Hierarchiesstring sampleDirectory = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); DirectoryInfo[] dirs = new DirectoryInfo (sampleDirectory).GetDirectories(); var query = from d in dirs where (d.Attributes & FileAttributes. 阅读全文

posted @ 2012-03-05 21:56 Sanic 阅读(258) 评论(0) 推荐(0) 编辑

重视Linq技术_6

摘要: Filtering//1、Simple Local Filterstring[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" }; IEnumerable<string> query = names.Where (name => name.EndsWith ("y")); query.Dump ("In lambda syntax"); query = from n in names w 阅读全文

posted @ 2012-03-05 21:00 Sanic 阅读(209) 评论(0) 推荐(0) 编辑

2012年3月4日

重视Linq技术_5

摘要: Building Query Expressions//1、Compiling Expression TreesProducts.DeleteAllOnSubmit (Products.Where (p => p.ID == 999));Products.InsertOnSubmit (new Product { ID = 999, Description = "Test", LastSale = DateTime.Now } );SubmitChanges();Product[] localProducts = Products.ToArray();Expressi 阅读全文

posted @ 2012-03-04 23:47 Sanic 阅读(255) 评论(0) 推荐(0) 编辑

重视Linq技术_4

摘要: //LINQ to SQL//1、Baisc queryCustomers.Single (c => c.ID == 2) .Dump ("Customer With ID Of 2");//2、AssociationsCustomer cust1 = Customers.OrderBy (c => c.Name).First();foreach (Purchase p In cust1.Purchases)Console.WriteLine (p.Price);//3、 Retrieve the customer who made the lowest val 阅读全文

posted @ 2012-03-04 22:43 Sanic 阅读(178) 评论(0) 推荐(0) 编辑

2012年3月2日

cross apply 和 outer apply

摘要: APPLY的执行过程:它先逻辑计算左表表达式,然后把右表达式应用到左表表达式的每一行。cross tb表都存在姓名的情况下才出现,outer tb外表存在的都显示。 create table #T(姓名 varchar(10))insert into #T values('张三')insert into #T values('李四')insert into #T values(NULL )crea... 阅读全文

posted @ 2012-03-02 23:48 Sanic 阅读(183) 评论(0) 推荐(0) 编辑

2012年3月1日

重视Linq技术_3

摘要: Interpreted Queries//1、Simple LINQ to SQL Queryfrom c in Customerswhere c.Name.Contains ("a")orderby c.Name.Lengthselect c.Name.ToUpper()//2、Combining Interpreted and Local Queriesvoid Main(){//This uses a custom 'Pair' extension method, defined below.IEnumerable<string> q = 阅读全文

posted @ 2012-03-01 22:53 Sanic 阅读(152) 评论(0) 推荐(0) 编辑

重视Linq技术_2

摘要: //Deferred Execution//1、Introductionvar numbers = new List<int>();numbers.Add (1); //10IEnumerable<int> query = numbers.Select (n => n * 10);// Build querynumbers.Add (2); //20 // Sneak in a... 阅读全文

posted @ 2012-03-01 21:45 Sanic 阅读(194) 评论(0) 推荐(0) 编辑

2012年2月29日

Nutshell

摘要: use Nutshellif exists (select * from sysobjects where name = 'PurchaseItem') drop table PurchaseItemif exists (select * from sysobjects where name = 'Purchase') drop table Purchaseif exists (select *... 阅读全文

posted @ 2012-02-29 23:33 Sanic 阅读(343) 评论(0) 推荐(0) 编辑

2012年2月28日

重视Linq技术_1

摘要: 推荐一个Linq学习工具:LinqPad 网址:http://www.linqpad.net/ 下载: for .net 3.5:http://www.linqpad.net/GetFile.aspx?LINQPad.exe for .net 4.0:http://www.linqpad.net/GetFile.aspx?LINQPad4.zip //1、Now for a simp... 阅读全文

posted @ 2012-02-28 23:29 Sanic 阅读(281) 评论(2) 推荐(0) 编辑

2011年12月20日

传智播客_Android笔记2

摘要: 使用ContentProvider共享数据ContentProvider类主要方法的作用:public boolean onCreate()该方法在ContentProvider创建后就会被调用, Android在系统启动时就会创建ContentProvider 。public Uri insert(Uri uri, ContentValues values)该方法用于供外部应用往ContentProvider添加数据。public int delete(Uri uri, String selection, String[] selectionArgs)该方法用于供外部应用从ContentPr 阅读全文

posted @ 2011-12-20 13:01 Sanic 阅读(613) 评论(0) 推荐(0) 编辑

导航