try {
Connection lig = DriverManager.getConnection(
"jdbc:mysql://localhost/gym", "root", "0000");
PreparedStatement inst = lig
.prepareStatement("SELECT * FROM produtos_has_historico WHERE Produtos_idProdutos AND Historico_idHistorico");
ResultSet a = inst.executeQuery();
while (a.next()){
DefaultListModel model = new DefaultListModel();
model.addElement(a);
}
} catch( Exception e ){}
在此选择中,我获得了id历史记录
和id产品
,但我还想获取其他表中产品的名称和价格“产品”添加到我的 Jlist,我可以使用两个选择吗?谢谢。
最佳答案
在一个 try-catch block 中有两个选择不是问题。
关于java - 我可以尝试放置两个 Select 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30436236/