📄 notedaoimpl.java
字号:
package zd.bbs ;
import java.sql.* ;
import java.util.* ;
import java.math.*;
import org.omg.CORBA.Request;
public class NoteDAOImpl implements NoteDAO
{
// //��ҳ����
// //static int model_id;
// //public int nowPages=1;//��ǰҳ
// //public int pages;//����ҳ��
// public int countPerPage = 10; //ÿҳ��ʾ����
// //public int recordCount=this.sum1(model_id);//�ܼ�¼��
// //public int pageCount = (int)Math.ceil((recordCount+countPerPage-1)/countPerPage);//�����ҳ��
//
// ��Ӳ���
public void insert(Note note) throws Exception
{
String sql = "INSERT INTO talk(username,title,talk_content,model_id2,talk_face,photo_up,photo_sm) VALUES(?,?,?,?,?,?,?)" ;
PreparedStatement pstmt = null ;
DataBaseConnection dbc = null ;
dbc = new DataBaseConnection() ;
try
{
pstmt = dbc.getConnection().prepareStatement(sql) ;
pstmt.setBytes(1,note.getUsername().getBytes());
pstmt.setBytes(2,note.getTitle().getBytes()) ;
pstmt.setBytes(3,note.getTalk_content().getBytes()) ;
pstmt.setInt(4,note.getModel_id2());
pstmt.setString(5,note.getTalk_face());
pstmt.setString(6, note.getPhoto_up());
pstmt.setString(7, note.getPhoto_sm());
pstmt.executeUpdate() ;
pstmt.close() ;
}
catch (Exception e)
{
}
finally
{
dbc.close() ;
}
}
/**
// �IJ���
// ɾ�����
public void delete(int id) throws Exception
{
String sql = "DELETE FROM note WHERE id=?" ;
PreparedStatement pstmt = null ;
DataBaseConnection dbc = null ;
dbc = new DataBaseConnection() ;
try
{
pstmt = dbc.getConnection().prepareStatement(sql) ;
pstmt.setInt(1,id) ;
pstmt.executeUpdate() ;
pstmt.close() ;
}
catch (Exception e)
{
throw new Exception("�����г��ִ��
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -