java.sql.SQLException:未找到任何数据
我只希望我的记录按天计算,包括费率、税款和金额之和,但要根据税款进行区分,即一天中的5%税款分录汇总和在不同的行中,以及13%的税款分录汇总将是不同的行java.sql.SQLException:未找到任何数据,java,mysql,swing,jcreator,Java,Mysql,Swing,Jcreator,我只希望我的记录按天计算,包括费率、税款和金额之和,但要根据税款进行区分,即一天中的5%税款分录汇总和在不同的行中,以及13%的税款分录汇总将是不同的行 try { Connection con=Conn.getConnection(); Statement ps=con.createStatement(); ResultSet rs=ps.executeQuery("Select Store, InvoiceDate, sum(Rate
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
获取字符串和日期,这怎么可能
rs.getString(1); <--- String Value at index 1
rs.getDate(1)); <---- Date Value at index 1
rs.getString(1);查询中没有错误。没有语法错误