java.sql.SQLException:找不到数据

时间:2015-03-18 11:27:46

标签: java mysql swing jcreator

我只希望我的记录日明智,费率,税和税的总和;金额,但根据税收区分,即5%的税收条目总和&在不同的行和& 13%的税收条目与总和将是一个差异。行。

    try {

        Connection con=Conn.getConnection();
        Statement ps=con.createStatement();
        ResultSet rs=ps.executeQuery("Select Store, InvoiceDate, sum(Rate*quantity), Percen, sum(Tax*Quantity), sum(Amount) from Orders Group By InvoiceDate, Store, Percen");

        while(rs.next()){

            v=new Vector();

            v.add(rs.getString(1));
            v.add(converToString(rs.getDate(2)));
            v.add(rs.getDouble(3));
            v.add(rs.getString(4));
            v.add(rs.getDouble(5));
            v.add(rs.getDouble(6));

            mDateWise.addRow(v);
        }
        con.close();
    }
    catch (Exception ex) {

        JOptionPane.showMessageDialog(c,ex.toString());
    }

显示错误java.sql.SQLException:找不到数据。帮助!!

1 个答案:

答案 0 :(得分:2)

您从索引1获取字符串和日期,这是怎么回事?

rs.getString(1); <--- String Value at index 1
rs.getDate(1)); <---- Date  Value at index 1