Object[][] a;
//要返回的结果数组
pst = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
String sql="select * from clothes;";
//这里sql语句,可以更改
ResultSet re1= pst.executeQuery(sql);
//执行sql语句
re1.last(); // 将光标移动到最后一行
int rowCount = re1.getRow(); // 得到当前行号,即结果集记录数
int count=0;
re1.beforeFirst();
a=new Object[rowCount][8];
while(re1.next()){
a[count][0]=re1.getString("name");
a[count][1]=re1.getString("id");
a[count][2]=re1.getString("大类");
a[count][3]=re1.getString("小类");
a[count][4]=re1.getFloat("进价");
a[count][5]=re1.getFloat("售价");
a[count][6]=re1.getInt("数量");
a[count][7]=re1.getString("供货商");
swing:遍历获取数据库内容,并插入到table中
最新推荐文章于 2023-12-12 14:47:44 发布