java sql exception parameter not set

前端 未结 1 678
半阙折子戏
半阙折子戏 2021-01-21 03:48

I am trying to get data from a database in a table with 2 where parameters, When i try to execute this code it gives the error: Parameter not set. I think it is a small mistake

1条回答
  •  粉色の甜心
    2021-01-21 04:20

    You just need to supply a second parameter for the Datum value:

    PreparedStatement s = con.prepareStatement("Select Kaartnummer, Datum, Maaltijd, Prijs FROM Logbestanden WHERE Kaartnummer=? AND Datum=?");
    s.setInt(1, Kaartnummer);
    s.setInt(2, Datum);  // this is what you are missing
    rset = s.executeQuery();
    

    0 讨论(0)
提交回复
热议问题