zoukankan      html  css  js  c++  java
  • DataTable 使用Select方法查询并排序,以及【拼接转义符的问题】

    关于DataTable 里面用 /转义符拼接的问题

    //这种写法表面上是正确,实现上在运行时调用Select方法实行查询会报错 
    string str = resetstrWhere + """ + "," + """ + dataQuery.DefaultOrderByClause; table = table.Select(str).CopyToDataTable();
    //这种写法表面上是正确,实现上在运行时调用Select方法实行查询会报错
    string
    str = string.Format("{0}","{1}", resetstrWhere, dataQuery.DefaultOrderByClause); table = table.Select(str).CopyToDataTable();
    //这种方法是正确的。
    DataTable table =new DataTable(); table = table.Select(string.Format("{0}", resetstrWhere), string.Format("{0}", Tool.sortName + strtype)).CopyToDataTable();

    DataTable 使用Select方法

    Select();

    Select("id>='3' and name='3--hello'");//支持and

    Select("id>='3' or id='1'");//支持or

    Select("name like '%hello%'");//支持like   

     Select("id>5","id desc");

    Select("id>5", "id desc",DataViewRowState.Added);

  • 相关阅读:
    uoj 36 玛里苟斯
    readlink
    Endless Spin
    rm
    rmdir
    [学习笔记]min-max容斥
    cp
    [HAOI2015]按位或
    java实现第四届蓝桥杯公式求值
    java实现第四届蓝桥杯危险系数
  • 原文地址:https://www.cnblogs.com/suntanyong88/p/4562706.html
Copyright © 2011-2022 走看看