DataTable dt = ds.Tables[0]; DataRow[] drs = dt.Select("Id=" + categoryID ); 解决方法:将参数用单引号阔起来 DataRow[] drs = dt.Select("Id='" + categoryID + "'");
C# DataTable的过滤条件中过滤字段参数类型必须和表对应的列数据类型一致。如上面routeId 为字符型,所以过滤条件为:categoryID = '10',而不应该为 categortID = 10
https://www.cnblogs.com/MRRAOBX/articles/3300398.html