在SQL查询中对应着各种各样的查询关键字,如果distinct,count,sum 等等一些关键字。在Linq to SQL 中对这些关键字的使用做了封装,同样在ALinq 中也有相同的操作函数。

 

1. ALinq 过滤查询重复数据 Distinct

 1 /// <summary>
 2         /// ALinq 查询关键字 Distinct
 3         /// </summary>
 4         public void FunctionDistinct()
 5         {
 6             OA_DBDataContext context = new OA_DBDataContext(new SqlConnection(connectionString));
 7             context.Log = Console.Out;
 8             var alinq = (from s in context.TabMenu select s.ParentID).Distinct();
 9             foreach (var value in alinq)
10             {
11                 Console.WriteLine(value);
12             }
13             Console.WriteLine("\n");
14         }

相关文章:

  • 2021-08-01
  • 2022-12-23
  • 2021-11-28
  • 2021-05-05
  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
猜你喜欢
  • 2021-07-20
  • 2021-10-06
  • 2021-10-24
  • 2021-10-08
  • 2021-11-15
  • 2021-07-03
相关资源
相似解决方案