ASP文章分类问题
发布网友
发布时间:2023-07-13 14:30
我来回答
共2个回答
热心网友
时间:2024-12-14 09:41
导航栏:
---------------------------------------------------------
<%
Set Dhrs=conn.Execute("SELECT * FROM class ",,adCmdText)
If Dhrs.Bof And Dhrs.Eof Then
Response.Write("没有记录")
Else
Do While Not Dhrs.Eof
Response.Write("<a href='wenzhang.asp?id="&Dhrs("id")&"' target='_self'>"&Dhrs("title")&"</a>")
Dhrs.MoveNext()
Loop
End If
Dhrs.Close()
Set Dhrs=Nothing
%>
-------------------------------------------------------------
文章列表:
-------------------------------------------------------------
<%
Dim aid,asql
aid=Request.QeryString("id")
If IsNumeric(aid) Then
Response.Write("参数类型错误")
Response.End
End If
asql="SELECT id,classid,title,(SELECT class FROM class WHERE id=classid) as Lb FROM book where classid="&aid
Set atrs=conn.Execute(asql,,adCmdText)
If atrs.Bof And atrs.Eof Then
Response.Write("无记录")
Else
Do While Not atrs.Eof
Response.Write("<a href='showwenzhang.asp?id="&atrs("id")&"' target='_self'>["&atrs("Lb")&"]"&atrs("title")&"</a>")
Loop
End If
atrs.Close()
Set atrs=Nothing
%>
当然咯,文章导航栏需要你自己美化一下。祝你成功\(^o^)/~
热心网友
时间:2024-12-14 09:41
读出列表页book表
Set rs=Server.CreateObject("Adodb.Recordset")
sql="Select * from book"
rs.open sql,conn,1,1
以下是分页之类的。
读出当前classid
在
Set rs1=Server.CreateObject("Adodb.Recordset")
sql="Select * from class id="&刚才获取的ID
rs1.open sql,conn,1,1
下面的应该知道了吧