首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

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

2012-01-18 
操作excel数据库 sql的语句问题int select_idInteger.parseInt(production.getText())String name_strt

操作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这两列

热点排行