關於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);