当前位置: 代码迷 >> Eclipse >> 操作excel数据库 sql的语句有关问题
  详细解决方案

操作excel数据库 sql的语句有关问题

热度:294   发布时间:2016-04-23 18:57:16.0
操作excel数据库 sql的语句问题
 
  int select_id=Integer.parseInt(production.getText());
  String name_str=type.getText();
  ResultSet set = smt.executeQuery("select * from [sheet1$] where Id="+select_id +"and UserName="+name_str);
 运行到红色部分语句时,总是出现错误java.sql.SQLException: [Microsoft][ODBC Excel Driver] 参数不足,期待是 1。
 不知道哪出错了?请教!谢谢!

------解决方案--------------------
ResultSet set = smt.executeQuery("select * from [sheet1$] where Id='"+select_id +"' and UserName=[color=#FF0000][/color]'"+name_str + "'");
试试
------解决方案--------------------
查下你连接的Excel的列有没有Id和UserName这两列
  相关解决方案