var p = DataTable.AsEnumerable().Where(t => t.Field<int>("ChannelID") == int.Parse(code)).Select(d => d);
if (p != null && p.Count() > )
{
return p.Select(c => c.Field<string>("name")).First();
}
else
{
return "";
}

DataTable AsEnumerable 的使用的更多相关文章

  1. c# Lamdba及DataTable AsEnumerable()的使用

    Lamdba是延迟执行的,实际上什么都没有发生,当真正使用对象的时候(例如调用:First, Single, ToList-.的时候)才执行. 1.Where var var_dtTable = dt ...

  2. DataTable无法使用AsEnumerable ()的解决办法

    本人定义了DataSet后将表1赋给datatable,在写linq时调用datatable.asenumerable(),但报datatable不包含asenumerable的定义,求高手指点.Sy ...

  3. DataTable与DTO对象的简易转换类

    在web开发过程中,有时候为了数据传输的方便,比如:后台需要更新前端的ViewModel,此时我们定义一个与前端ViewModel结构一样的DTO对象,从数据层获取数据后,将数据封装成DTO然后序列化 ...

  4. c# datatable list 相互转换

    /*Converts List To DataTable*/ public static DataTable ToDataTable<TSource>(IList<TSource&g ...

  5. C# DataTable怎么合计字段

    DataTable dt = new DataTable(); var age=dt.Compute("avg(age)",""); var height =d ...

  6. Conversion Between DataTable and List in C#

    1.List to DataTable public static DataTable ToDataTable<TSource>(this IList<TSource> dat ...

  7. DataTable某一列转换为分隔字符串

    //把DataTable的某一列转化为逗号分隔字符串 private static string DataTableColumnSplit(DataTable dataTable,string str ...

  8. csharp:Conversion Between DataTable and List

    /// <summary> /// http://www.codeproject.com/Tips/784090/Conversion-Between-DataTable-and-List ...

  9. 简洁的导出 datatable到excel,不用组件

    简洁的导出 datatable到excel var lines = new List<string>(); string[] columnNames = dataTable.Columns ...

随机推荐

  1. centos 6.5 安装 nginx+php+mysql

    一.准备工作 (1)配置防火墙 1.首先检查iptables服务的状态 [root@woxplife ~]# service iptables status iptables: Firewall is ...

  2. 使用fragment,Pad手机共用一套代码

    项目代码结构: 1:MainActivity.java package com.example.fgtest; import android.app.Activity; import android. ...

  3. GitHub好站点

    https://github.com/XingCloud/stream_processor

  4. Css 小技巧总结

    相对偏移 指定left top等属性就能够够完美控制一个元素的位置 如: position:relative; left:2px; 今天遇到一个很好玩的问题,当两个并排浮动框,当一个框的长度太大时就会 ...

  5. UESTC_最少花费 2015 UESTC Training for Dynamic Programming<Problem D>

    D - 最少花费 Time Limit: 30000/10000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submi ...

  6. convertView

    [convertView] 参考:https://zhidao.baidu.com/question/423895201122905772.html

  7. 论文:network embedding

    KDD2016: network embedding model: deep walk(kdd 2014): http://videolectures.net/kdd2014_perozzi_deep ...

  8. Radar Installation(贪心,可以转化为今年暑假不ac类型)

    Radar Installation Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other) ...

  9. SVG 和字符图标

    制作网站往往需要使用一些图标来提高用户体验,如果我们的是一些扁平化设计的图标,我们可以选择 SVG 或 图标字体来提高用户体验. 下面对这两种技术进行比较. 开发难度: 现在的在线工具非常强大,比如  ...

  10. JavaScript类的设计

    [转载] Javascript与其他的面向对象语言不同,如C++,Java或PHP等.它并不是基于类的,而是基于原型的一种语言. 1.对象创建 在Javascript中创建一个类是非常容易的: var ...