求ASP查询ACCESS数据库代码

wsmhzyaba 2008-04-11 09:45:27
求ASP查询ACCESS数据库代码
数据库名字是zhongyi
数据表名是mincheng
查找其中的所有xingming


求ASP查询ACCESS数据库代码
求ASP查询ACCESS数据库代码
求ASP查询ACCESS数据库代码
...全文
817 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
philcc 2008-04-11
  • 打赏
  • 举报
回复
<%
'数据库连接
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("zhongyi.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (数据库路径)};"
Set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
<body>
<%
Sql="select xingming from mincheng "
Set mRs=Server.CreateObject("adodb.recordSet")
mRs.open sql,conn,1,1
If mRs.bof and mRs.eof then
Response.Write"<span>没有记录</span>"
Else
while not mRs.eof
response.Write mRs("xingming") & "<br>"
mRs.movenext
wend
End If
%>
</body>
<%
conn.close
mRs.close
set conn = nothing
set mRs = nothing
%>
叶随风 2008-04-11
  • 打赏
  • 举报
回复
select xingming from [mincheng]
No_Data_Found 2008-04-11
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<%
'数据库连接
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("zhongyi.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};" '数据库连接地址
Set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>
<body>
<%
Sql="select xingming from mincheng "
Set mRs=Server.CreateObject("adodb.recordSet")
mRs.open sql,conn,1,1
If mRs.bof and mRs.eof then
Response.Write"<span>没有任何记录</span>"
Else
while not mRs.eof
response.Write mRs("xingming") & "<br>"
mRs.movenext
wend
End If
%>
</body>
<%
conn.close
mRs.close
set conn = nothing
set mRs = nothing
%>
</html>

28,409

社区成员

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

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