zoukankan      html  css  js  c++  java
  • Linq合并两个DataTable

     var linqbitem = from wip in dt_onwip.AsEnumerable()
                            join bitem in dt_cos_bitem.AsEnumerable() on wip.Field<string>("item_no").Trim() equals bitem.Field<string>("item_no").Trim() into s
                            from t in s.DefaultIfEmpty()
                            select new
                            {
                                item_no = wip.Field<string>("item_no"),
                                item_class = wip.Field<string>("item_class"),
                                onwipqty = wip.Field<decimal>("onwipqty"),
                                avg_cost = (t == null) ? 0 : t.Field<double>("avg_cost")
                            };

    ----------------------------------------------------------------------------------------------

     var var_dt = from trdord in dt_trdord.AsEnumerable()
                         join per in dt_per.AsEnumerable() on trdord.Field<string>("ord_nbr") equals per.Field<string>("ord_nbr") into s
                         from r in s
                         select new
                         {
                             //trd_ord
                             ord_nbr = trdord.Field<string>("ord_nbr"),
                             plan_shp_date = trdord.Field<DateTime>("plan_shp_date"),
                             mo_required_date = trdord.Field<DateTime>("mo_required_date"),
                             item_no = trdord.Field<string>("item_no"),
                             ord_um = trdord.Field<string>("ord_um"),
                             ord_qty = trdord.Field<decimal>("ord_qty"),
                             shp_qty = trdord.Field<decimal>("shp_qty"),
                             detail_status = trdord.Field<string>("detail_status"),
                             //percent
                             MA = r.Field<string>("MA"),
                             D = r.Field<string>("D"),
                             E = r.Field<string>("E"),
                             MU = r.Field<string>("MU"),
                             PUR = r.Field<string>("PUR"),
                             MN = r.Field<string>("MN"),
                         };

  • 相关阅读:
    iOS开发网络篇—GET请求和POST请求
    iOS开发网络篇—HTTP协议
    iOS开发网络篇—搭建本地服务器
    iOS开发网络篇—网络编程基础
    编程生涯
    使用NSURLSession实现断点续传
    定义设置颜色的RGB值的宏
    IB_DESIGNABLE的使用
    java文件和目录的增删复制
    Android离线语音识别(PocketSphinx)
  • 原文地址:https://www.cnblogs.com/gerryge/p/2294616.html
Copyright © 2011-2022 走看看