码迷,mamicode.com
首页 > 数据库 > 详细

linq,sqlmethods,like

时间:2016-10-06 12:57:03      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

LINQ to SQL will translate .NET methods in this manner:

  • text.StartsWith(...) = LIKE ...%
  • text.Contains(...) = LIKE %...%
  • text.EndsWith(...) = LIKE %...
  • var customers = (from stu in db.Customer
    where stu.rowguid.ToString().StartsWith("a")
    select stu).ToList();

    foreach(var stu in customers)
    {
    Console.WriteLine(stu.PersonID + "," + stu.rowguid.ToString());
    }

    Console.WriteLine("\n\n\nThere are {0} rows data in table \n", customers.Count);
    Console.ReadLine();

linq,sqlmethods,like

标签:

原文地址:http://www.cnblogs.com/Fred1987/p/5933643.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!