<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open Server.MapPath("db/data.mdb") set rs=conn.Execute("Select * from cm100") Response.Write "<table border=1>" While Not rs.EOF Response.Write "<tr>" For i = 1 To 3 If rs.EOf Then Response.Write "<td> </td><td> </td>" Else Response.Write "<td>" & rs("mingcheng") & "</td>" //应该怎样给显示的名字加链接 Response.Write "<td>" & rs("xingbie") & "</td>" rs.MoveNext End If
Next Response.Write "</tr>" Wend Response.Write "</table>" %>
[最优解释] <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open Server.MapPath("db/data.mdb") set rs=conn.Execute("Select * from cm100 where xingbie like '男'") Response.Write "<table border=1>" While Not rs.EOF Response.Write "<tr>" For i = 1 To 4 If rs.EOf Then Response.Write "<td></td><td></td>" Else Response.Write "<td><a href='www。baidu.com' >" & rs("bbs_mingcheng") & "</a></td>" rs.MoveNext End If
Next Response.Write "</tr>" Wend Response.Write "</table>" %> [其他解释]
5678910111213141516171819202122
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open Server.MapPath("db/data.mdb")set rs=conn.Execute("Select * from cm100 where sex='男'")//这里加一个取数据条件过滤即可。 Response.Write "<table border=1>"While Not rs.EOF Response.Write "<tr>" For i = 1 To 3 If rs.EOf Then Response.Write "<td> </td><td> </td>" Else Response.Write "<td><a href='要跳到的地址'>" & rs("mingcheng") & "</a></td>" //应该怎样给显示的名字加链接 Response.Write "<td>" & rs("xingbie") & "</td>" rs.MoveNext End If NextResponse.Write "</tr>"Wend Response.Write "</table>"%>
------其他解决方案--------------------
嗯,这样的确很痛苦,因为你没有数据库开发经验,建议你先抽空学一下数据库,大休下学习一下,然后,再学习一下HTML标签之类的,磨刀不误功啊,先静心下来,各一功破,再统一进行开发 [其他解释] 第一个问题: 如果你是用的ASP .NET 实现的,你可以这样实现,你用的数据控件GridView 绑定数据库,在GridView 中你添加一列为 HyperLinkFied,在数据属性中,DataNavigateUrlFields 后面写上数据库字段的名字,DataNavigateUrlFormatString后面写上调转的页,DataTextField 后面写上数据库字段的名字。这样就能实习名字上的跳转。 第二个问题: 查询数据库语句,select * from table where sex ='男'
希望对你有帮助 [其他解释] <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open Server.MapPath("db/data.mdb") set rs=conn.Execute("Select * from cm100") //加什么代码能筛选出字段"xingbie" 中的男 Response.Write "<table border=1>" While Not rs.EOF Response.Write "<tr>" For i = 1 To 3 If rs.EOf Then Response.Write "<td> </td><td> </td>" Else Response.Write "<td>" & rs("mingcheng") & "</td>" //应该怎样给显示的名字加链接 Response.Write "<td>" & rs("xingbie") & "</td>" rs.MoveNext End If
Next Response.Write "</tr>" Wend Response.Write "</table>" %>