Myeclipce 用dao不太会用 不知道该怎么写

来源:百度知道 编辑:UC知道 时间:2024/06/18 04:41:11
实现对数据库的层删改查的用途

不会是要源代码吧?
我说下你自己写吧,大致是这样的,声明sql语句,创建数据库连接。然后调用sql语句进行增删改查。
。。还是写一点吧。
String sql = "select 字段 from 表名";
final List items = new ArrayList();
jt.query(sql, new RowCallbackHandler() {
public void processRow(ResultSet result) throws SQLException {

if (result != null) {
do {
Form d = new Form();
d.setFORMID(result.getString(1));
d.setFORMNAME(result.getString(2));// 表单名称
d.setENTETYTABLE(result.getString(3));// 数据库名称
d.setAPPNAME(result.getString(4));// 应用名称
d.setCREATORNAME(result.getString(5));// 创建者
d.setCREATORTIME(result.getDate(6));// 创建时间
d.setSTATE(result.getString(7));// 状态
d.setFORMDESCRIPTION(result.getString(8));// 描述

items.add(d);
} while (result.next());