Statement st=conn.createStatement();
String sql="select * from Test where id='"+id+"'";
try{
ResultSet result=st.executeQuery(sql);
String name=result.getString("name");
System.out.println(st.getConnection().toString());
result.close();
st.close();
return name;
}catch(Exception e){
System.out.println(e);
}
3 个解决方案
#1
贴出你的异常信息
#2
while(result.next()){
String name=result.getString("name");
}
String name=result.getString("name");
}
#3
to rui888
问题解决了,谢谢
问题解决了,谢谢
![java.sql.SQLException: 未调用 ResultSet.next java.sql.SQLException: 未调用 ResultSet.next](https://image.shishitao.com:8440/aHR0cHM6Ly93d3cuaXRkYWFuLmNvbS9nby9hSFIwY0hNNkx5OW1iM0oxYlM1amMyUnVMbTVsZEM5UWIybHVkRVp2Y25WdEwzVnBMM05qY21sd2RITXZZM05rYmk5UWJIVm5hVzR2TURBekwyMXZibXRsZVM4eE5pNW5hV1k9.jpg?w=700&webp=1)
#1
贴出你的异常信息
#2
while(result.next()){
String name=result.getString("name");
}
String name=result.getString("name");
}
#3
to rui888
问题解决了,谢谢
问题解决了,谢谢
![java.sql.SQLException: 未调用 ResultSet.next java.sql.SQLException: 未调用 ResultSet.next](https://image.shishitao.com:8440/aHR0cHM6Ly93d3cuaXRkYWFuLmNvbS9nby9hSFIwY0hNNkx5OW1iM0oxYlM1amMyUnVMbTVsZEM5UWIybHVkRVp2Y25WdEwzVnBMM05qY21sd2RITXZZM05rYmk5UWJIVm5hVzR2TURBekwyMXZibXRsZVM4eE5pNW5hV1k9.jpg?w=700&webp=1)