asp无需配置iis实现伪静态的例子
asp教程无需配置iis实现伪静态的例子
<!--#include file="config.asp"-->
<ol>
<%
'功能:asp实现伪静态的例子
Set rs=server.CreateObject("adodb.recordset")
sql="select * from Article"
rs.open sql,conn,1,1
do while not rs.eof
%>
<li><a href="article.asp?/<%=rs("id")%>.html"><%=left(trim(rs("title")),30)%></a></li>
<%
rs.movenext
loop
rs.close
set rs=Nothing
%>
</ol>
<%
'功能:asp实现伪静态的例子
'来源:网络
id=request.QueryString("id")
If id="" Then
server_v40=Request.ServerVariables("QUERY_STRING")
id=Int(replace(replace(server_v40,"/",""),".html",""))
End If
Call ReadNews()
%>
<div>
标题: <b><%= News_title%></b><br />
内容: <%=News_content%>
</div>
<%
'功能:asp实现伪静态的例子
'网址:.net教程">www.zzzyk.com
'来源:网络
'数据库教程链接
db="data.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
If Err Then
err.Clear
Set conn = Nothing
Response.Write "数据库连接出错,请检查连接字串。"
Response.End
End If
'定义新闻阅读界面的读取
Dim News_title,News_content
Sub ReadNews()
set rs1=server.createobject("adodb.recordset")
sql1="select id,title,content from article where id="& ID
rs1.open sql1,conn,3,3
News_title=rs1("title")
News_content=rs1("content")
rs1.close
set rs1=Nothing
End Sub
%>
补充:asp教程,高级应用