📄 newsimpl.java~6~
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -