CommentDAOClass.asp
上传用户:qfkgdy
上传日期:2020-06-18
资源大小:1888k
文件大小:2k
- <%
- Class CommentDAOClass
- Public Function save(ByVal e)
- Set sql=new SQLClass
- sql.table="comment"
- sql.add "gid",e.getGid(),0,0
- sql.add "id",e.getId(),0,0
- sql.add "mid",e.getMid(),0,0
- sql.add "account",e.getAccount(),"",1
- sql.add "content",e.getContent(),"",1
- sql.add "add_ip",e.getAdd_ip(),"",1
- conn.execute(sql.insert)
- Set sql=nothing
- e.setCid(conn.execute("SELECT @@IDENTITY FROM comment")(0))
- Set save=e
- End Function
- Public Sub delete(ByVal e)
- conn.execute("DELETE FROM comment WHERE cid="&e.getCid())
- End Sub
- Public Function load(ByVal id)
- Set load=new CommentEntity
- sql="SELECT * FROM comment WHERE cid="&id
- Set DAORS=getRecordSet(conn,sql,1,1)
- if not DAORS.eof then
- load.setCid(DAORS("cid"))
- load.setGid(DAORS("gid"))
- load.setId(DAORS("id"))
- load.setMid(DAORS("mid"))
- load.setAccount(DAORS("account"))
- load.setContent(DAORS("content"))
- load.setAdd_time(DAORS("add_time"))
- load.setAdd_ip(DAORS("add_ip"))
- else
- Set load=nothing
- end if
- DAORS.close
- Set DAORS=nothing
- End Function
- Public Function list(ByVal by,order)
- Dim strBy,strOrder
- if(by<>"") then
- strOrder="ORDER BY "&by&" "&order
- end if
- sql="SELECT * FROM comment "&strOrder
- Set list=getRecordSet(conn,sql,1,1)
- End Function
-
- Public Function show(ByVal gid,id,num)
- Dim strNum
- if(num<>"") then
- strNum=" top "&num
- end if
- sql="SELECT "&strNum&" * FROM comment WHERE gid="&gid&" AND id="&id&" ORDER BY add_time DESC"
- Set show=getRecordSet(conn,sql,1,1)
- End Function
-
- Public Function counts(ByVal gid,id)
- sql="SELECT count(0) as c FROM comment WHERE gid="&gid&" AND id="&id
- Set DAORS=getRecordSet(conn,sql,1,1)
- if not DAORS.eof then
- counts=DAORS("c")
- else
- counts=0
- end if
- DAORS.close
- Set DAORS=nothing
- End Function
-
- End Class
- %>