阳台煮酒

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 数据库tt的examstudent数据表如下:
 
在MySQL中执行查询语句如下:
ResultSet rs = null;

String sql="SELECT flow_id,Type,id_card,exam_card,student_name,location,grade FROM examstudent";

rs = st.executeQuery(sql);
rs:数据集。
rs.getInt(int index);
rs.getInt(String columName);
你可以通过索引或者列名来获得查询结果集中的某一列的值。
例如:while(rs.next)
{
rs.getInt(1)//等价于rs.getInt("flowid");
rs.getString(5)//等价于rs.getInt("student_name");
}

 

posted on 2016-09-29 17:27  阳台煮酒  阅读(24347)  评论(0编辑  收藏  举报