DataTable 使用Select方法查询并排序,以及【拼接转义符的问题】
2015-06-09 10:13
651 查看
关于DataTable 里面用 /转义符拼接的问题
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);
//这种写法表面上是正确,实现上在运行时调用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);
相关文章推荐
- a questions
- OSG程序设计之osg::NodeVisitor
- Python实现数据库编程方法详解
- linux创建磁盘分区的脚本文件(创建两个512M和2G的主分区)
- lua内存机制分析
- 九宫格 GridView
- js控制键盘按键(回车、空格
- PHP长整型在32位系统中强制转化溢出
- C# List 去重
- DRUPAL 慢的原因
- [工作][JFACE,SWT] menu, toolBar
- iOS中nil、Nil、NULL、NSNull详解
- Android图片的固定大小展示
- 简介JavaScript中的push()方法的使用
- 字节序的那些事情
- 巧说table的几种构造方式
- 求最大重叠区间大小
- 跨平台工程移植:opencv_pnp + artoolkitplus :ubuntu qtcreator--> windows qtcreator/ VS
- 软件项目管理面面观之“玩的就是心跳”
- jquery获取和设置radio,select,checkbox的值