}
/**
* 完成CD删除
* @param aid
* @return
* @throws java.lang.Exception
*/
public boolean delete( int aid ) throws Exception {
sqlStr = "delete from cd where id = " + aid ;
try
{ DataBase db = new DataBase();
db.connect();
stmt =db.conn.createStatement ();
stmt.execute(sqlStr);
return true;
}
catch (SQLException e)
{
System.out.println(e);
return false;
}
}
/**
* 完成CD单本查询,用于支持页面的查看CD详细资料
* @param newid
* @return
* @throws java.lang.Exception
*/
public boolean getOnecd(int newid ) throws Exception {
DataBase db = new DataBase();
db.connect();
stmt =db.conn.createStatement ();
try {
sqlStr="select a.id,a.cdname,a.cdclass,b.classname,a.Singer,"+
"a.publish,a.cdno,a.musiclist,a.Price,a.amount,a.Leav_number,"+
"a.regtime,a.picture from cd a,cdclass b where a.cdclass="+
"b.Id and a.Id = " + newid ;
rs = stmt.executeQuery(sqlStr);
if (rs.next())
{ cdlist = new Vector(1);
cd cd = new cd();
cd.setId(rs.getLong("id"));
cd.setcdName(rs.getString("cdname"));
cd.setcdClass(rs.getInt("cdclass"));
cd.setClassname(rs.getString("classname"));
cd.setSinger(rs.getString("Singer"));
cd.setPublish(rs.getString("publish"));
cd.setcdNo(rs.getString("cdno"));
cd.setmusiclist(rs.getString("musiclist"));
cd.setPrice(rs.getFloat("Price"));
cd.setAmount(rs.getInt("amount"));
cd.setLeav_number(rs.getInt("leav_number"));
cd.setRegTime(rs.getString("regtime"));
cd.setPicture(rs.getString("picture"));
cdlist.addElement(cd);
} else {
close();
return false;
}
close();
return true;
}
catch (SQLException e)
{
return false;
}
}
public int getPage() { //显示的页码
return page;
}
public void setPage(int newpage) {
page = newpage;
}
public int getPageSize(){ //每页显示的CD数
return pageSize;
}
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] 下一页