ASP(Active Server Pages)是Microsoft很早就推出的一种WEB应用程序解决方案,也是绝大多数从事网站开发人员很熟悉的一个比较简单的编程环境。通过ASP我们可以创建功能强大的动态的WEB应用程序。ASP虽然功能很强大,但有些功能用纯ASP代码完成不了,为了能保证开发出功能更加强大的WEB应用程序,我们可以借助调用COM组件。
看来楼主没有看ASP书!但是还要写ASP的数据库调用的程序!建议楼主看看网上的电影网代码
或者是新闻发布的代码1
以下是我写的一个例子
注意开头需要连接头文件(还是我写出来吧!)
<%
dim conn
dim connstr
db="data/#lvshizhe.asa" '数据库文件位置
'on error resume next
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
response.Write(err)
else
conn.open connstr
end if
function decrypt(dcode)
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,2))-i)
next
decrypt=texts
end function
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,2))+i)
next
encrypt = texts
end function
%>
----------------------------------
<%reid=request("id")'这里就是上面所谓的505
if isnumeric(reid)=false then response.Redirect("error.asp")
rs=server.CreateObject("adodb.recordset")
sql="select * from news where new_ID="&reid
set rs=conn.execute(sql)
if rs.eof=true then response.Redirect("error.asp")%>
以上是从数据库取数据,要显示数据库的时候用这样的语句
<%=rs("在这里写你的表字段")%>
他的用法和你在网页上面写的东西效果是一样的