看看这段代码是做什么用的,谢谢
<%
dim dizhi
if oRs( "ClassID ")> 0 then
if oRs( "Child ")> 0 then
ChildID= " "
set tClass=oConn.execute( "select ClassID from NewsClass where ParentID= " & oRs( "ClassID ") & " or ParentPath like ' " & oRs( "ParentPath ") & ", " & oRs( "ClassID ") & ",% ' ")
do while not tClass.eof
if ChildID= " " then
ChildID=tClass(0)
else
ChildID=ChildID & ", " & tClass(0)
end if
tClass.movenext
loop
else
ChildID=oRs( "ClassID ")
end if
end if
Set zRs=Server.CreateObject( "ADODB.Recordset ")
zSql= "Select top 5 D_ID,D_ClassID,d_Source,D_Title,D_Count From NewsData Where D_ClassID in ( " & ChildID & ") and d_recycle=false ORDER BY d_id DESC "
zRs.Open zSql,oConn,1,1
Set zRspic=Server.CreateObject( "ADODB.Recordset ")
zSql= "Select top 1 D_ID,D_ClassID,D_Title,D_Count,D_picture From NewsData Where D_ClassID in ( " & ChildID & ") and d_recycle=false and d_picture <> ' ' ORDER BY d_id DESC "
zRspic.Open zSql,oConn,1,1
dizhi=zRs( "d_Source ")
%>
zRs,zSql,ChildID是已经定义好的变量
谢谢,我是初学者,如果可以,请讲清楚,再次谢谢大家了
------解决方案--------------------全不明白还是部分不明白?
这个奇怪的地方也就是 Where D_ClassID in ( " & ChildID & ")
意思就是D_ClassID的值是childid的一个就条件成立,childid就是前面NewsClass表的地方取的,他取出来的记录组合成了一个长长的字符串
我觉得两个表关联一下也能解决