-2
Ich erhalte den Fehler "Kein spezifischer Wert für Parameter 1". Ich möchte Benutzer aus der Benutzer-IDKein Wert für Parameter 1 angegeben
public ArrayList<booking> viewRestaurantsBooking() throws Exception {
System.out.println("In viewRestaurantsBooking!");
ArrayList<booking> myRestaurantsBookingList = new ArrayList<booking>();
try {
String selectStatement = "select * from famnection.bookrest where UserId=?";
PreparedStatement prepStmt = con.prepareStatement(selectStatement);
ResultSet rs = prepStmt.executeQuery();
while (rs.next()) {
System.out.println("Record Found!");
booking myBookings = new booking();
System.out.println("Restaurant Name=" + rs.getString("restName"));
myBookings.setRestName(rs.getString("restName"));
System.out.println("Booking Date=" + rs.getString("bookingdate"));
myBookings.setBookingdate(rs.getDate("bookingdate"));
System.out.println("Booking Time=" + rs.getString("bookingtime"));
myBookings.setTime(rs.getString("bookingtime"));
myRestaurantsBookingList.add(myBookings);
}
} catch (Exception ex) {
throw new Exception("Error:" + ex.getMessage());
}
System.out.println("myRestaurantsList SIZE=" + myRestaurantsBookingList.size());
return myRestaurantsBookingList;
}
Was UserID denken Sie, es sucht in der where-Klausel, wenn Sie ausführen Ihre Anfrage? – csmckelvey
Fehlermeldungen sind [ausgezeichnete Suchbegriffe] (https://stackoverflow.com/search?q=No+value+specified+for+parameter+1). Respektiere sie nicht und täusche sie nicht. – BalusC