在将 varchar 值 'k339' 转换成数据类型 int 时失败。
public List find(String stationNum,String stations){
List list = new ArrayList();
try{
super.open();
String sql ="select * from station where stationID = '"+ stationNum +"' and station = '"+ stations+ "' ";
ResultSet rs= super.findSQL(sql);
while(rs.next()){
findEntiy findEntiy = new findEntiy();
findEntiy.setStationID(rs.getString("stationID"));
findEntiy.setOutTime(rs.getString("outTime"));
findEntiy.setDayTime(rs.getString("dayTime"));
findEntiy.setSitePrice(rs.getString("sitePrice"));
findEntiy.setStation(rs.getString("station"));
findEntiy.setTrainNum(rs.getString("trainNum"));
list.add(findEntiy);
}
}catch(ClassNotFoundException e){
e.printStackTrace();
}catch(SQLException e){
e.printStackTrace();
}finally{
super.close();
}
return list;
}
........
信息: Server startup in 768 ms
com.microsoft.sqlserver.jdbc.SQLServerException: 在将 varchar 值 'k339' 转换成数据类型 int 时失败。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.buildNextRowset(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.sendExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteQuery(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(Unknown Source)
at dao.basedao.findSQL(basedao.java:61)
at dao.findDao.find(findDao.java:13)