⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testtypebo.java~18~

📁 考试管理系统:实现学生信息的注册、修改、查询、删除;以及对试题进行管理:增加试题、修改试题、删除试题、查询试题
💻 JAVA~18~
字号:
/**
 * 试题类型业务对象(Test type business object)
 */
package edu.sccp.examManager.business;

import edu.sccp.examManager.VO.TestTypeVO;
import edu.sccp.examManager.database.ConnectBean;
import edu.sccp.examManager.tools.Tools;
import edu.sccp.examManager.client.AdminMainFrame;
import java.util.ArrayList;
import java.sql.SQLException;
import java.sql.PreparedStatement;

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

    public String findByTypeName(String name){
        String typeId=null;
        ConnectBean cb = new ConnectBean();
        PreparedStatement ps=null;
        if (!cb.openConnection()) {
            Tools.showDialog("数据库连接失败!");
            return null;
        }
        try {
            ps=cb.createPreparedStatement("select f_typeid from t_testtype where f_name=?");
            ps.setString(1,name);
            cb.executeQuery();
            while (cb.next()) {
                typeId=cb.getString(1).trim();
            }
        } catch (SQLException ex) {
            Tools.println(ex.getMessage());
            return null;
        }

        return typeId;
    }

    public ArrayList testTypeQuery(){
        ArrayList list = null;
        ConnectBean cb = new ConnectBean();
        if (!cb.openConnection()) {
            Tools.showDialog("数据库连接失败!");
            return null;
        }
        try {
            cb.createPreparedStatement("select * from t_testtype");
            cb.executeQuery();
            list = new ArrayList();
            //String data = "类型编号**类型名称**类型级别**所属类型**备注**";
            //list.add(data);
            while (cb.next()) {
                TestTypeVO testType = new TestTypeVO();
                testType.setTypeId(cb.getString(1).trim());
                testType.setTypeName(cb.getString(2).trim());
                testType.setType(cb.getString(3).trim());
                testType.setTypeParent(cb.getString(4).trim());
                testType.setTypeMemo(cb.getString(5));
                list.add(testType);
            }
        } catch (SQLException ex) {
            Tools.println(ex.getMessage());
        }
        return list;
    }
}

⌨️ 快捷键说明

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