在请教一下: strSql.Append("select max(id1) as a,min(id1) as b from etw_product where categoryName=" + name + " "); 这条报错 strSql.Append("select max(id1) as a,min(id1) as b from etw_product"); 这条ok! 这是为什么?语法错误 (操作符丢失) 在查询表达式 'categoryName=General Valve Series' 中。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Exception: 语法错误 (操作符丢失) 在查询表达式 'categoryName=General Valve Series' 中。源错误: 行 228: catch(System.Data.OleDb.OleDbException ex) 行 229: { 行 230: throw new Exception(ex.Message); 行 231: } 行 232: return ds;
我也没测试,你自己再测试测试吧,将strSql.Append("select max(id1) as a,min(id1) as b from etw_product where categoryName=" + name + " ");改为strSql.Append("select max(id1) as a,min(id1) as b from etw_product where categoryName='" + name + "' ");
在请教一下:
strSql.Append("select max(id1) as a,min(id1) as b from etw_product where categoryName=" + name + " "); 这条报错
strSql.Append("select max(id1) as a,min(id1) as b from etw_product"); 这条ok!
这是为什么?语法错误 (操作符丢失) 在查询表达式 'categoryName=General Valve Series' 中。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Exception: 语法错误 (操作符丢失) 在查询表达式 'categoryName=General Valve Series' 中。源错误:
行 228: catch(System.Data.OleDb.OleDbException ex)
行 229: {
行 230: throw new Exception(ex.Message);
行 231: }
行 232: return ds;