I'm doing an assignment for college Using a query in netbeans to a database in ms access that took me two solid days of head scratching to get to so far. Problem is it will give me a lovely result as soon as I open the package and run it. There after I get this error:
net.ucanaccess.jdbc.UcanaccessSQLException: invalid cursor state: identifier cursor not positioned on row in UPDATE, DELETE, SET, or GET statement: ; ResultSet is empty.
I would appreciate any help you could give. Thanks a lot.
private void FindFlghtBtnActionPerformed(java.awt.event.ActionEvent evt) {
try{
rs = stmt.executeQuery("SELECT DepAirportTable.AirportName, DepAirportTable.AirportDesignaton, FlightTable.DepDate, ArrAirportTable.ArrAirportName, ArrAirportTable.ArrAirportDesignaton\n" +
"FROM PlaneTable INNER JOIN (ArrAirportTable INNER JOIN (DepAirportTable INNER JOIN FlightTable ON DepAirportTable.AirportDesignaton = FlightTable.FromAirDes) ON ArrAirportTable.ArrAirportDesignaton = FlightTable.ToAirDes) ON PlaneTable.FlightDesignationCode = FlightTable.[FlightDesignationCode]\n" +
"WHERE (((DepAirportTable.AirportName)=\""+DepCombo.getSelectedItem()+"\") AND ((FlightTable.DepDate)=#"+((JTextField)DateDep.getDateEditor().getUiComponent()).getText()+"#) AND ((ArrAirportTable.ArrAirportName)=\""+ArrComboBox.getSelectedItem()+"\"));");
rs.next();
{
departure = rs.getString("AirportName");
depDate = rs.getString("DepDate");
arrival = rs.getString("ArrAirportName");
BookingPrevTa.setText("Your flight details are:\nDeparting from "+departure+" arriving at: "+arrival+" departing on: "+depDate);
rs.close();
}
}
catch (SQLException ee)
{
ee.printStackTrace();
}
}