用ASP搜索名字,从ACCESS数据库中读取txt文件并显示出来

2025-02-22 09:46:35
推荐回答(2个)
回答1:

给你一个按Name搜索的例子
假设数据库已连接,连接变量为conn,数据集为RS
ASP文件源码如下:
-----------------
<%
dim bodytxt,name 'name用于接收表单提交的数据
name=trim(request.form("name"))
sql="select * from A where NAME='" & name & "'"
rs.open sql , conn,1,1
do while not rs.eof
bodytxt=rs("body)
rs.movenext
loop
rs.close

set fso=Server.CreateObject("scripting.filesystemobject")
set fs=fso.OpenTextFile(server.mappath("body.txt"),2,1)
fs.write bodytxt
fs.close
set fs=nothing
set fso=nothing
response.redirect "body.txt"
%>

其它功能需要继续完善。

回答2:

用txt的形式?你的意思是txt数据库?还是什么?