jtable如何使用rs2xml [英] jtable how to use rs2xml
本文介绍了jtable如何使用rs2xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前是java的新手,我一直在寻找一种将数据库信息放到jtable的有效方法,我听说过rs2xml。我真的想学习这个,因为其他方法让我感到困惑并让我头痛。
I'am currently newbie at java, and I've been searching for a effective way to put database informations to jtable and I heard about rs2xml. I really want to learn this because other methods makes me confuse and gives me headache.
有谁知道如何有效地使用它?如果您不介意,可以用简单的代码解释。
Does anyone know how to use it effectively ? And if you don't mind can you explain with a simple code.
提前致谢。
推荐答案
import net.proteanit.sql.DbUtils;
try {
st = conn.createStatement();
st.executeQuery(q);
ResultSet rs = st.executeQuery(q);
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex);
} finally {
try {
rs.close();
} catch (SQLException e) { /* ignore */
}
try {
st.close();
} catch (SQLException e) { /* ignore */
}
}
使用
的样本视频教程
这篇关于jtable如何使用rs2xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文