diff --git a/PaginationUtil.cs b/PaginationUtil.cs index dba4dc5..c44e0ad 100644 --- a/PaginationUtil.cs +++ b/PaginationUtil.cs @@ -271,10 +271,16 @@ public static int CountSql(string layerName, string whereSql) { string sql = "select count(1) from " + layerName + " where " + whereSql; - - DataTable table = OledbHelper.QueryTable(sql); - int result = int.Parse(table.Rows[0].ItemArray[0].ToString()); - return result; + try + { + DataTable table = OledbHelper.QueryTable(sql); + int result = int.Parse(table.Rows[0].ItemArray[0].ToString()); + return result; + } + catch + { + return -1; + } } } }