zoukankan      html  css  js  c++  java
  • 2016.1.22 利用LINQ实现DataSet内多张DataTable关联查询操作(目前未发现太大价值)

    DataSet ds = new DataSet();

                DataTable t1 = DBFactorySingleton.GetInstance().Factory.GetDataTable(sql_ndp).Copy();

                t1.TableName = "t1";

                DataTable t2 = DBFactorySingleton.GetInstance().Factory.GetDataTable(sql_naip).Copy();

                t2.TableName = "t2";

                ds.Tables.Add(t1);

                ds.Tables.Add(t2);

     

                var restable =

                    from f1 in ds.Tables[0].AsEnumerable()

                    from f2 in ds.Tables[1].AsEnumerable()

                    where f1.Field<string>("类型") + f1.Field<string>("名称") + f1.Field<string>("识别") == f2.Field<string>("类型") + f2.Field<string>("名称") + f2.Field<string>("识别")

                    //where f1.Field<string>("类型") + f1.Field<string>("名称")=="VOR_DME英德"

                    select new

                    {

                        c1 = f1.Field<string>("源"),

                        c2 = f1.Field<string>("类型"),

                        c3 = f1.Field<string>("名称"),

                        c4 = f1.Field<string>("识别"),

                        c5 = f1.Field<string>("磁差"),

                        c6 = f1.Field<string>("坐标"),

                        c7 = f1.Field<string>("频率"),

                        c8 = f1.Field<string>("波道"),

                        c9 = f1.Field<string>("天线高"),

                        c10 = f1.Field<string>("强制报告")

                    };

                gdc_pmatch.DataSource = restable.ToArray();

  • 相关阅读:
    Android CTS 测试
    Cygwin 不兼容Win7 64
    真滴有太多不懂的的东西,有点扛不住了。
    ffmpeg yasm not found, use disableyasm for a crippled build
    手机搜索不到 Connectify
    Android ICS 横竖屏切换时不销毁Activity
    MinGw\bin\ar.exe: libavcodec/: Permission denied
    Cannot complete the install because one or more required items could not be found.
    Eclipse 启动时报错 JVM terminated. Exit code=1
    【Java 从入坑到放弃】No 5. 控制流程
  • 原文地址:https://www.cnblogs.com/mol1995/p/5964950.html
Copyright © 2011-2022 走看看