当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp程序实现伪静态的代码
静态页面是蜘蛛喜欢的,会得到蜘蛛经常光顾的,以至于网站上的内容会得到搜索引擎更多的收录
这里介绍一个asp伪静态的程序实现方法
数据库是access,表名article,里面有id,title,content
config.asp连接数据库文件
< %
'功能:asp实现伪静态的例子
'网址:www.aspprogram.cn
'来源:网络
'数据库链接
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
% >
index.asp新闻列表页
评论 (0) All