courcedao.java~5~

来自「这是一个员工管理系统」· JAVA~5~ 代码 · 共 55 行

JAVA~5~
55
字号
package com.orilore.ssms.dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.SQLException;
import com.orilore.ssms.entity.Student;
import java.util.*;
import com.orilore.ssms.entity.Cource;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2009</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class CourceDao {
    public CourceDao() {
    }

    public int findIdByName(String name){
        Connection conn = DbManager.getConn();
        PreparedStatement pst = null;
        int id = 0;
        try {
            pst = conn.prepareStatement("select id from cource where cname=?");
            pst.setString(1,name);
            ResultSet rs = pst.executeQuery();
            if(rs.next()){
                id = rs.getInt("id");
            }
            rs.close();
            pst.close();
            conn.close();

        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return id;

    }

    public List<Cource> findAll(){
        List<Cource> list = null;

        return list;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?