• DataSet 比较 select


    View Code
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Data;
     6 
     7 namespace DataSetConr
     8 {
     9     class Program
    10     {
    11 
    12         public static void AddDataSetData(DataSet ds)
    13         {
    14             ds.Reset();
    15             DataTable dt = new DataTable();
    16             DataColumn dc = new DataColumn("guid", typeof(Guid));
    17             DataColumn dc2 = new DataColumn("show", typeof(Boolean));
    18             DataColumn dc3 = new DataColumn("isnull", typeof(Boolean));
    19             dt.Columns.Add(dc); dt.Columns.Add(dc2); dt.Columns.Add(dc3);
    20             DataRow dr = dt.NewRow();
    21             dr.BeginEdit();
    22             dr["guid"] = Guid.NewGuid();
    23             dr["show"] = true;
    24             dr["isnull"] = false;
    25             dr.EndEdit();
    26             dt.Rows.Add(dr);
    27             ds.Tables.Add(dt);
    28         }
    29 
    30         static void Main(string[] args)
    31         {
    32 
    33             DataSet ds = new DataSet();
    34             DataSet ds2 = new DataSet();
    35             AddDataSetData(ds);
    36             AddDataSetData(ds2);
    37             foreach (DataRow item in ds.Tables[0].Rows)
    38             {
    39                 //查看A在B中是否存在
    40                 DataRow[] rows = ds2.Tables[0].Select(string.Format("show={0} and isnull={1}",item["show"].ToString(),item["isnull"].ToString()));
    41                 if (rows.Length==0)
    42                 {
    43                    
    44                 }
    45             }
    46         }
    47     }
    48 }
  • 相关阅读:
    并发编程(线程)
    并发编程(进程)
    并发编程(操作系统的介绍)
    模块与包
    网络编程
    Django项目的创建与管理和pycharm与Github的秘密
    python解释器配置和python常用快捷键
    代码的调试.运行
    57. 三数之和
    1347. 尾随零
  • 原文地址:https://www.cnblogs.com/p_db/p/2505482.html
Copyright © 2020-2023  润新知