jasperreports

时间:2016-08-18 19:55:33

标签: java jasper-reports

我有代码从查询中设置ID值:

Connect c=new Connect();
Statement stmt=c.Connstr.createStatement();
ResultSet rs = stmt.executeQuery("select Res_ID,RDate,Receipt,MethodofPayment as 'Installmets?',InstallmentCount as 'Installmets Count',InstallmentStartDate as 'Start',Client_Name as 'Client',Project_Name 'Project',Unit_Name as 'Unit' from reservationwithdetails where Client_ID="+Vars.get_Client_ID()+"");
SearchTable.setModel(buildTableModel(rs));
ResultSet NewRec = stmt.executeQuery(""
    + "select ID from reservation "
    + "where "
    + "Client_ID ="+Vars.get_Client_ID()+" and Project_ID ="+Vars.get_Project_ID()+" and Unit_ID ="+Vars.get_Unit_ID()+"" );
while(NewRec.next()){
    Vars.Set_Newest_Reservation_ID(NewRec.getInt("ID"));
}

所以,我在这里给出Vars.Set_Newest_Reservation_ID(int ID)

的值

当我调用它时,我使用Vars.Newest_Reservation_ID(),所以我添加了新的向导jassper报告并设计了这样的查询:

SELECT Res_ID, RDate, UnitPrice, ReversationFee, Client_Name, Project_Name, Unit_Name FROM reservationwithdetails
WHERE Res_ID = Vars.Newest_Reservation_ID()

我在此声明表单中出错,我知道这是错误的......现在我如何才能使此报表查询从外部变量获取Res_ID值?

0 个答案:

没有答案