zoukankan      html  css  js  c++  java
  • LINQ,SQL查询,LINQ 实现常见SQL查询

       1.Top 查询----skip(index).Take(count)

          var Results = from dt in ctx.Customers.Skip(0).Take(10)
                                  select new
                                  ...{
                                      dt.CustomerID,
                                      dt.CompanyName,
                                      dt.City
                                  };

        2.Like 查询----startwith()
                   from dt in ctx.Customers
                   where dt.ID.Startwith('A')

        3.In查询----Contain()
          string[] s = ...{ "ivan","aaa","aaaa"};
                    var Results = from dt in ctx.Customers.Skip(0).Take(10)
                                  where s.Contains(dt.CustomerID)
                                  select new
                                  ...{
                                      dt.CustomerID,
                                      dt.CompanyName,
                                      dt.City
                                  };

  • 相关阅读:
    Arm宣布将在Linux中应用事务内存扩展支持
    企业上云哪种形式的云更适合?
    AT&T推出云5G网络开源工具Airship
    GitHub源码攻击事件
    你应该选择哪种树莓派?
    Electron 5.0 发布
    Redox OS 发布 0.5 版
    经典的网络安全技术
    inux下:热插拔和模块是什么
    微软宣布全新命令行+脚本工具:PowerShell 7
  • 原文地址:https://www.cnblogs.com/wysimon/p/1338862.html
Copyright © 2011-2022 走看看