java查询数据库中的数据并显示
关注:93 答案:2 mip版
解决时间 2021-01-17 16:29
提问者笑低了眉眼
2021-01-17 04:11
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//
Driver d=new org.hsqldb.jdbc.JDBCDriver();
try{
int id=Integer.parseInt(text.getText());
Connection conn =DriverManager.getConnection(
"jdbc:hsqldb:file:f:/ysc/database/","SA","");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from xscj where ID=id");
}
//目地:根据ID查找数据中的数据,并在表格中显示出来。
//问1:executeQuery返回的Res