使用MVC模式开发程序,完成数据的模糊查询(5)
来源:未知 责任编辑:责任编辑 发表时间:2014-02-18 03:25 点击:次
	   
	student.setSex(resultSet.getString("sex"));
student.setAddress(resultSet.getString("address"));
arrayList.add(student);
}
} catch (SQLException e) {
e.printStackTrace();
}
return arrayList;
}
public static void close(Connection conn) {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
conn = null;
}
}
public static void close(Statement stmt) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
stmt = null;
}
}
}
[sql]
drop database testmvc; 
create database testmvc; 
use testmvc; 
create table student ( 
    id int not null primary key auto_increment, 
    name varchar(10), 
    age int, 
    sex varchar(2), 
    address varchar(50) 
    ); 
        insert into student values(null,'张三',20,'男','北京市东城区天安门'); 
	
相关新闻>>
- 发表评论
- 
				
- 最新评论 进入详细评论页>>


