public void deleteCatalog(String FatherID){ int tempData=0; sql="select fatherID,linkstr,AncestorID from catalog where productID="+FatherID; rs=conn.execute(sql); try{ if(rs.next()){ tempData=rs.getInt("fatherID"); LinkStr=rs.getString("linkstr"); AncestorID=rs.getString("AncestorID"); }
try{rs.close();} catch(Exception e){ System.out.println(e); } sql="delete from catalog where ProductID="+FatherID; // out.println(sql); try{ conn.execute(sql); }catch(Exception e){ System.out.println(e); } sql="delete from catalog where linkstr like ′′"+LinkStr+"%′′ and AncestorID="+AncestorID; //out.println(sql); try{ conn.execute(sql); }catch(Exception e){ System.out.println(e); } sql="update catalog set ChildNum=ChildNum-1 where productID="+tempData; //out.println(sql); try{ conn.execute(sql); }catch(Exception e){ System.out.println(e); } }catch(Exception e){ System.out.println(e); } } //end public
public void updateCatalog(int id){
}
public String getCatalog(int id){
str="<select name="FatherID" class="p9"> "+ "<option value="-1" >请选择父类</option> "; String sql=null; sql="select * from catalog order by AncestorID,Linkstr"; ResultSet rs=conn.execute(sql); try{ while (rs.next()) { int ProductID=rs.getInt("productID"); if (ProductID==id) { str=str+"<option value="+ProductID+" selected>"; } else{ str=str+"<option value="+ProductID+">"; } int nbspCount=rs.getString("LinkStr").length()-1; for(int i=0;i<nbspCount;i++){ str=str+" "; } if(nbspCount>0) str=str+"┠"+rs.getString("title")+"</option> "; else str=str+rs.getString("title")+"</option> ";