樱花_殇 2014-09-19 05:37 采纳率: 0%
浏览 2039

sql语句中的?赋值失败??求大家帮忙找找原因,在下感激不尽

private Connection conn = null;
private PreparedStatement pstmt = null;
private ResultSet rs = null;

public List supplierfindbyname(Supplierlocation su) {
// TODO Auto-generated method stub
List sulist = new ArrayList();
String sql = "select * from fanwe_supplier_location where name = ?";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
System.out.println("su.getSuppname()----"+su.getSuppname());
pstmt.setString(1,"'%"+su.getSuppname()+"%'");
rs = pstmt.executeQuery();
System.out.println("sql----"+sql);
while(rs.next())
{
System.out.println("结果集中取出来的name----"+rs.getString("name"));
Supplierlocation supp = new Supplierlocation();
supp.setSuppname(rs.getString("name"));
supp.setPreview(rs.getString("preview"));
supp.setAvgpoint(rs.getFloat("avg_point"));
supp.setTakeawayprice(rs.getFloat("takeaway_price"));
supp.setTakeawaytime(rs.getInt("takeaway_time"));
supp.setShopcount(rs.getInt("shop_count"));
supp.setDeal_cate_match_row(rs.getString("deal_cate_match_row"));
supp.setXpoint(rs.getString("xpoint"));
supp.setYpoint(rs.getString("ypoint"));
sulist.add(supp);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally
{
closeConnection(conn, pstmt, rs);
}
return sulist;
}

  • 写回答

2条回答 默认 最新

  • 樱花_殇 2014-09-19 06:05
    关注

    自己顶.......................................

    评论

报告相同问题?

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常