debug一下,rs11是空集了吧
数据库语句改一下;
改成
select name, max(id),price from table where id= (select max(id) from table)
这里的name, max(id),price是你想要看的属性
max(id)匹配后面最大的id。
不加max会报错的
ResultSet是集合啊,直接getString?
JDBC中的ResultSet API没有直接获取记录条数的方法,ResultSet直接getString是不对的。
int rowCount = 0;
if(rsll.next())
{
// rowCount=rs.getInt("id");
//或者
rowCount = rs.getInt(1);
}
select * from 表 order by id desc limit 1