newsimpl.java~6~

来自「JBuilder 2006 +SQL Server2000 +JavaBean+」· JAVA~6~ 代码 · 共 61 行

JAVA~6~
61
字号
package com.pet.background.model.DAO.impl;

import com.pet.background.model.DAO.*;
import java.sql.ResultSet;
import com.pet.util.DBCon;
import java.sql.*;
import com.pet.background.model.DTO.NewsBean;
import java.util.ArrayList;

public class Newsimpl implements NewsDao {
    public Newsimpl() {
    }

    ResultSet rs = null;
    DBCon db = new DBCon();

    /**
     * addbiaoti
     * 添加标题
     * @param Nbiaoti String
     * @param Npath String
     * @param Nbk String
     * @return int
     * @todo Implement this com.pet.background.model.DAO.NewsDao method
     */
    public int addbiaoti(String Nbiaoti, String Npath, String Nbk) {
        int i = 0;
        String strsql = "insert news(Nbiaoti,Npath,Nbk)values('"+Nbiaoti+"','"+Npath+"','"+Nbk+"')";
        try {
            i = db.updateResult(strsql);
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }
        return i;
    }

    /**
     * 根据板块查询标题
     * @param Nbk String
     * @return NewsBean
     */

    public ArrayList seebiaoti(String Nbk) {
        ArrayList al = new ArrayList();
        String strsql = "select * from news where nbk='"+Nbk+"'";
        try {
            rs = db.querySQL(strsql);
            while(rs.next()){
                NewsBean newsbean = new NewsBean();
                newsbean.setNbiaoti(rs.getString("Nbiaoti"));
                newsbean.setNpath(rs.getString("Npath"));
                newsbean.setNbk(Nbk);
            }
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }

        return al;
    }
}

⌨️ 快捷键说明

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