• 大小: 864KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: Java
  • 标签:

资源简介

用java+sqlservser2005写的旅行社信息管理系统 用eclipse编写的

资源截图

代码片段和文件信息

package biz;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import sql.ConnectionFactory;
import entity.JoinTravelGroup;

public class JoinTravelGroupManager {
//插入一个JoinTravelGroup
public static void addJoinTravelGroup(JoinTravelGroup jointravelgroup){
// 1.连接数据库
Connection con = ConnectionFactory.getConnection();
// 2.发出Insert命令并执行
String sql = “insert into JoinTravelGroup(TravelerIdTravelGroupId) values(??)“;
try {
PreparedStatement pstm = con.prepareStatement(sql);
pstm.setInt(1jointravelgroup.getTravelerId());
pstm.setInt(2jointravelgroup.getTravelGroupId());

pstm.executeUpdate();
// 3.关闭连接
pstm.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
//显示所有JoinTravelGroup
public static List getAllJoinTravelGroup(){
//1.连接数据库
List list=new ArrayList();
Connection con = ConnectionFactory.getConnection();
//2.执行select语句并返回ResultSet
String sql = “select * from JoinTravelGroup“;
try{
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
//3.遍历ResultSet并且把每行数据转为一个InputStock对象并存入List
while(rs.next()){
JoinTravelGroup tr= new JoinTravelGroup();
tr.setId(rs.getInt(“Id“));
tr.setTravelerId(rs.getInt(“TravelerId“));
tr.setTravelGroupId(rs.getInt(“TravelGroupId“));
tr.setModifiedDate(rs.getDate(“ModifiedDate“));
list.add(tr);
}
//4.关闭连接并返回List
rs.close();
stmt.close();
con.close();
}catch(SQLException e){
e.printStackTrace();
System.out.println(e.getMessage());
}
return list;
}
//通过Id查询一个JoinTravelGroup
public static JoinTravelGroup getJoinTravelGroupById(int Id){
//1.连接数据库
JoinTravelGroup jointravelgroup=null;
Connection con = ConnectionFactory.getConnection();
//2.执行select语句并返回ResultSet
String sql = “select * from JoinTravelGroup where Id=?“;
try {
PreparedStatement pstm = con.prepareStatement(sql);
pstm.setInt(1Id);
ResultSet rs = pstm.executeQuery();

//3.遍历ResultSet并且把每行数据转为一个InputTravels对象
if(rs.next()){
jointravelgroup=new JoinTravelGroup();
jointravelgroup.setId(rs.getInt(“Id“));
jointravelgroup.setTravelerId(rs.getInt(“TravelerId“));
jointravelgroup.setTravelGroupId(rs.getInt(“TravelGroupId“));
jointravelgroup.setModifiedDate(rs.getDate(“ModifiedDate“));
}
// 4.关闭连接并返回jointravelgroup
rs.close();
pstm.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
return jointravelgroup;
}
//通过Id删除一个JoinTravelGroup
public static JoinTravelGroup deleteJoinTravelGroupById(int Id){
// 1.连接数据库
Connection con = ConnectionFactory.getC

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        355  2009-11-01 21:00  TravelManager\.classpath

     文件        389  2009-11-01 21:00  TravelManager\.project

     文件        215  2009-11-11 13:14  TravelManager\src\ui\TravelManager.java

     文件        312  2009-11-05 09:28  TravelManager\src\test\ConnectionFactoryTest.java

     文件       2166  2009-11-05 13:11  TravelManager\src\test\TravelsManagerTest.java

     文件       1910  2009-11-11 15:21  TravelManager\src\test\TravelerManagerTest.java

     文件       2004  2009-11-05 13:14  TravelManager\src\test\TravelGroupManagerTest.java

     文件       1730  2009-11-05 13:32  TravelManager\src\test\JoinTravelGroupManagerTest.java

     文件       1730  2009-11-05 14:17  TravelManager\src\test\QuitTravelGroupManagerTest.java

     文件       1890  2009-11-05 14:55  TravelManager\src\test\StatisticsTravelManagerTest.java

     文件        262  2009-11-21 23:00  TravelManager\src\test\frameTest.java

     文件        355  2009-11-10 10:31  TravelManager\src\test\UsersManagerTest.java

     文件        635  2009-11-17 19:42  TravelManager\src\sql\ConnectionFactory.java

     文件      14190  2009-11-13 16:06  TravelManager\src\frame\Mainframe.java

     文件       3518  2009-11-10 21:56  TravelManager\src\frame\Query\ById\JoinTravelGroupQueryByIdframe.java

     文件       3517  2009-11-10 21:58  TravelManager\src\frame\Query\ById\QuitTravelGroupQueryByIdframe.java

     文件       3538  2009-11-10 22:00  TravelManager\src\frame\Query\ById\TravelGroupQueryByIdframe.java

     文件       3569  2009-11-10 21:59  TravelManager\src\frame\Query\ById\StatisticsTravelQueryByIdframe.java

     文件       3443  2009-11-10 22:00  TravelManager\src\frame\Query\ById\TravelerQueryByIdframe.java

     文件       3482  2009-11-11 13:11  TravelManager\src\frame\Query\ById\TravelsQueryByIdframe.java

     文件       2635  2009-11-11 13:18  TravelManager\src\frame\Query\All\TravelsQueryAllframe.java

     文件       2679  2009-11-11 13:18  TravelManager\src\frame\Query\All\TravelGroupQueryAllframe.java

     文件       2601  2009-11-11 13:19  TravelManager\src\frame\Query\All\TravelerQueryAllframe.java

     文件       2690  2009-11-11 13:19  TravelManager\src\frame\Query\All\StatisticsTravelQueryAllframe.java

     文件       2595  2009-11-11 13:19  TravelManager\src\frame\Query\All\QuitTravelGroupQueryAllframe.java

     文件       2535  2009-11-11 12:32  TravelManager\src\frame\Query\All\JoinTravelGroupQueryAllframe.java

     文件       6582  2009-11-10 21:57  TravelManager\src\frame\Input\TravelsInputframe.java

     文件       5581  2009-11-10 21:57  TravelManager\src\frame\Input\TravelGroupInputframe.java

     文件       5957  2009-11-11 11:04  TravelManager\src\frame\Input\TravelerInputframe.java

     文件       4402  2009-11-10 21:56  TravelManager\src\frame\Input\JoinTravelGroupInputframe.java

............此处省略167个文件信息

评论

共有 条评论

相关资源