楼主把邮箱给我
javaGUI通信录,
满足你的要求
可以发给你

解决方案 »

  1.   

    楼主留下邮箱,发给你,呵呵
    很简单的,如果用jbuilder之类的话,要不了半个小时就能做一个满足要求的,就是几条语句,
    楼主留下邮箱,发给你,不过建议楼主自己写一个简单的,其实用到的东西不多,首先可以锻炼自己,增加自己的动手能力,
    最主要是可以增加自己的自信心,因为你自己解决了这个问题,这是最重要的,
      

  2.   

    楼主是为了学java吗?还是为了应付考试呀?
      

  3.   

    你是要B/S架构的还是C/S架构的
      

  4.   

    import java.sql.*;
    import java.util.ArrayList;
    import java.util.List;import dto.Student;public class StudentDAO implements IStudentDAO{
    public static void main(String[] args) {
    // Student s=new Student("aa",12,13.4f);
    // StudentDAO dao=new StudentDAO();
    // dao.intsertStudent(s);
    // StudentDAO dao=new StudentDAO();
    // List<Student>list=dao.getAllStudent();
    // dao.print(list);
    // StudentDAO dao=new StudentDAO();
    // dao.updateStudent();
    StudentDAO dao=new StudentDAO();
    dao.deleteStudent();
    }

    public void print(List<Student> list)
    {
    for(Student s:list)
    System.out.println(s.getName()+","+s.getAge()+","+s.getHeight());
    }

    public Connection getConnection()
    {
    Connection con=null;
    try {
    Class.forName("net.sourceforge.jtds.jdbc.Driver");
    con=DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/lwy","sa","lwy");
    } catch (Exception e) {
    e.printStackTrace();
    }
    return con;
    }

    public boolean deleteStudent()
    {
    boolean flag=false;
    Connection con=null;
    PreparedStatement pstmt=null;
    String sql="delete from student where id=14";
    try {
    con=this.getConnection();
    pstmt=con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    int count=pstmt.executeUpdate();
    if(count>0)
    flag=true;
    else
    flag=false;
    } catch (Exception e) {
    e.printStackTrace();
    flag=false;
    }
    finally
    {
    try {
    if(pstmt!=null)
    pstmt.close();
    if(con!=null)
    con.close();
    } catch (Exception e) {
    // TODO: handle exception
    }
    }
    return flag;
    }
    public boolean updateStudent()
    {
    boolean flag=false;
    Connection con=null;
    PreparedStatement pstmt=null;
    String sql="update student set age=12 where id=13";
    try {
    con=this.getConnection();
    pstmt=con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    int count=pstmt.executeUpdate();
    if(count>0)
    flag=true;
    else
    flag=false;
    } catch (Exception e) {
    e.printStackTrace();
    flag=false;
    }
    finally
    {
    try {
    if(pstmt!=null)
    pstmt.close();
    if(con!=null)
    con.close();
    } catch (Exception e) {
    // TODO: handle exception
    }
    }
    return flag;
    } @Override
    public boolean intsertStudent(Student s) {
    Connection con=null;
    PreparedStatement pstmt=null;
    String sql="Insert into Student (name,age,height) values(?,?,?)";
    boolean flag=false;
    try {
    con=this.getConnection();
    pstmt=con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    pstmt.setString(1, s.getName());
    pstmt.setInt(2, s.getAge());
    pstmt.setFloat(3, s.getHeight());
    int count=pstmt.executeUpdate();
    if(count>0)
    flag=true;
    else
    flag=false;
    } catch (Exception e) {
    e.printStackTrace();
    flag=false;
    }
    finally
    {
    try {
    if(pstmt!=null)
    pstmt.close();
    if(con!=null)
    con.close();
    } catch (Exception e) {
    // TODO: handle exception
    }
    }
    return flag;
    }
    @Override
    public List<Student> getAllStudent() {
    Connection con=null;
    PreparedStatement pstmt=null;
    ResultSet rs=null;
    String sql="select * from student";
    List<Student> list=new ArrayList<Student>();
    try {
    con=this.getConnection();
    pstmt=con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    rs=pstmt.executeQuery();
    while(rs.next())
    {
    Student s=new Student(rs.getString("name"),rs.getInt("age"),rs.getFloat("height"));
    list.add(s);
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    finally
    {
    try {
    if(rs!=null);
    rs.close();
    if(pstmt!=null)
    pstmt.close();
    if(con!=null)
    con.close();
    } catch (Exception e) {
    // TODO: handle exception
    }
    }
    return list;
    }}
    简单的增删改查全实现了。你自己加个窗体就ok了。
      

  5.   

    楼主只是要一个ConnectionManager?  晕 这还用上来问么?  书上没有么?
      

  6.   

    百度搜一下“JAVA学生信息管理系统”,很多人借鉴的程序。网上很多流传