public DatePicker selecteDOP;
public Label label;
String dop = ((TextField)selecteDOP.getEditor()).getText();
String msg1 ="";
@FXML
public void purchases(ActionEvent event){
msg1 = "First name Last name Username Description Code Size Cost Quantity Date of purchase\n";
try{
String qr = "SELECT j_fname,j_lname,username,description,code,size,cost,quantity,dop FROM jeff INNER JOIN purchase ON jeff.j_mail = purchase.username where dop='"+dop+"'";
rs = st.executeQuery(qr);
while (rs.next()){
msg1 += rs.getString("j_fname")+" "+rs.getString("j_lname")+" "+rs.getString("username")+" "+rs.getString("description")+" "+rs.getString("code")+" "+rs.getString("size")+" "+rs.getString("cost")+" "+rs.getString("quantity")+" "+rs.getString("dop")+"\n";
}
label.setText(msg1);
}catch (Exception e){
System.out.println(e);
}
}
我试图从数据库中检索用户从datepicker中选择的特定日期的数据,但我的代码不起作用。您能建议我如何克服它吗
暂无答案!
目前还没有任何答案,快来回答吧!