jdbc相关问题
Map<String, Object> param = new HashMap<String, Object>();
param.put("name", "godname");
param.put("rela", "like");
String str = "小美";
param.put("value", str);
为什么这样写会出现错误???
Map<String, Object> param = new HashMap<String, Object>();
param.put("name", "godname");
param.put("rela", "like");
String str = "小美";
param.put("value", str);
为什么这样写会出现错误???
2016-03-25
if(params!=null&¶ms.size()>0){ for (int i = 0; i < params.size(); i++) { Map<String, Object> map=params.get(i); sb.append(" and "+map.get("name")+" "+map.get("rela")+" "+?+" "); } } PreparedStatement ptmt=conn.prepareStatement(sb.toString()); ptmt.setString(5, map.get("value"));
在之前写map.get("value")的地方,换成'?',然后使用
ptmt.setString(5, map.get("value"));
对'?'位置进行赋值
举报