关于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);