asp网站于sql调用问题

来源:百度知道 编辑:UC知道 时间:2024/06/22 16:50:22
有两段代码 分别在不同的页面中,谁能指导我一下,让调用出来的信息条数设置为10条,否则会超出框架的,这样就整天不平衡了!
1:<%call issue_person(10,"newperson")%> (显示页的调用代码)

2:sub issue_person(num,term)
if num<=0 or not IsNumeric(num) then
num=5
end if
sql="select top "&num&" * from zt_Personal_pmember,zt_resumePersonal where zt_resumePersonal.resume_flag=1 and zt_resumePersonal.resume_quser=1 and zt_resumePersonal.resume_openness=0"

if term="newperson" then
sql=sql&" order by resume_announcedate desc,resume_id desc"
elseif term="tjperson" then
sql=sql&" and pmember_command=1"
sql=sql&" order by resume_announcedate desc"
end if
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if not(rs.eof) then
response.Write "<table width=100% border=1 cellpadding=0 cellspacing=0 bordercolor=#F6F6F6>"
i=0

if num<=0 or not IsNumeric(num) then
num=5
end if
这里的num是你调用多少条数据的条件。
你可以在后面加上
if num>10 then
num=10
end if

if num<=0 or not IsNumeric(num) then
num=5
end if

这段是没有用的吧! 去掉应该就可以了!

祝你成功!

你查询语句中不是有个top "&num&" 吗,你只是控制这个num为10就好了