嗯String getString(int columnIndex) Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language. String getString(String columnName) Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
columnIndex是表中的列号,或者也可以用表的列属性名columnName
返回的结果是数据类型Xxx,类型Xxx与你定义的数据类型要一致
一般就这样用
rs.last();//到最后一条数据记录
int lastrow=rs.getRow(); //获取最后一条记录行数
while(rs.next(){
String title1=rs.getString("title");//获取标题内容
.............
}
{
Xxx a=rs.getXxx(int columnIndex);
或者
Xxx a=rs.getXxx(String columnName);
}
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language. String getString(String columnName)
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.