asp查询

panda00 2003-10-19 09:45:32
各位高手,有基于access的查询源码吗?最重要的显示查询结果的那块,谢谢
...全文
59 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gmlxf 2003-10-20
  • 打赏
  • 举报
回复
select col1,col2 ... from table where .. order by ..
i594yangyang 2003-10-19
  • 打赏
  • 举报
回复
<%
Dim db,connstr,sql,rs
connstr = "DBQ="+server.mappath("yang_yang.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set db = Server.CreateObject("ADODB.Connection")
db.Open connstr
set rs = server.createobject("adodb.recordset")
sqlstr = "select * from online">

rs.open sqlstr,db,1,1

while not rs.eof and not rs.bof
Response.Write rs("ip")
wend
set rs = nothing
db.Close
set db = nothing
%>

Microsoft Acess 2002 的数据库:
yang_yang.mdb
表名是:online

字段:id ------ `自动编号
ip ------ 文本(40位)
time ---- 日期/时间


这是从 http://expert.csdn.net/Expert/topic/2367/2367571.xml?temp=.63435 剪过来来的一部分,具体自己去看了
  • 打赏
  • 举报
回复
查询结果的那块和普通的一样写呀

do while not rs.eof

response.write rs("name")

rs.movenext
loop
ayjg 2003-10-19
  • 打赏
  • 举报
回复
建立ODBC数据源(如MyDSN)
.........
conn.open "MyDSN"
rs.open "select * from table where Field like '%Condition%'",conn,1,3
if rs.eof then
reponse.write("没有找到符合条件的记录!")
else
response.write("<table>")
do while not rs.eof
response.write("<tr>")
for i=0 to rs.recordcount-1
response.write("<td>&rs(i)&</td>")
next
response.write("</tr>")
rs.movenext
loop
response.write("</tabel>")
end if
bineon 2003-10-19
  • 打赏
  • 举报
回复
我用like

——————————————————————————————————
www.91asp.cn
有时间到这里找资料找书籍,你会发现asp以及.net很容易!
前提是你努力学习!

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧