一个简单的查询,为什么单击“查询”没有反应?

itzhiren 2004-10-19 10:09:32
以下是query.asp的全部内容:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Query Result</title>
</head>

<body bgcolor="#ffffff">
<%
Dim Conn '数据库连接
Dim StrDSN '数据库连接字符串
Dim Rs '命令字符串
StrDSN="Provider=SQLOLEDB;Data Source=jw;Initial Catalog=khgl;User ID=sa;Password=;"
'建立和数据库master的连接
set Conn = Server.CreateObject("ADODB.Connection")
set Rs=Server.CreateObject("ADODB.RecordSet")
Conn.Open StrDSN

bh=request.form("txt1")
sql="select jfmx.dt_rq,jfmx.n_jfje,jfmx.c_yhls from jfmx,yhzl where jfmx.c_yh=yhzl.c_yh and jfmx.n_jfbz=1 and yhzl.c_bh=" & bh

rs.open sql,conn,1,1
response.write rs.recordcount
if rs.eof then
response.write "no record at all"
elseif not rs.eof then
response.write "<table border=1>"
response.write "<tr>"
for i=0 to rs.fields.count-1
response.write "<td><font color=blue>"&rs.Fields(i).Name&"</font></td>"
next
response.write "</tr>"
while not rs.EOF
response.write "<tr>"
for i=0 to rs.Fields.Count-1
response.write "<td>"&rs.Fields(i).Value&"</td>"
next
response.write "</tr>"
rs.MoveNext
wend
response.write "</table>"
%>
<form name="form1" method="post" action="query.asp">
<p>编号:
<input type="text" name="txt1">
</p>
<p>
<input type="submit" name="Submit" value="查询">
</p>
</form>
</body>
</html>
...全文
107 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
gamestar1 2004-10-19
  • 打赏
  • 举报
回复
如果你是直接点开query.htm的话,肯定是不行的。
gamestar1 2004-10-19
  • 打赏
  • 举报
回复
晕,你没有在iis下调试吧。
91jk 2004-10-19
  • 打赏
  • 举报
回复
你是用什么在测试啊?是不是用iis在测试啊
itzhiren 2004-10-19
  • 打赏
  • 举报
回复
我把查询语句写在query.asp中,以下是query.asp的全部代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim conn '数据库连接
Dim StrDSN '数据库连接字符串
Dim rs '命令字符串
dim sql
dim bh
StrDSN="Provider=SQLOLEDB;Data Source=vvv;Initial Catalog=sfgl;User ID=sa;Password=;"
'建立和数据库master的连接
set conn = Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.RecordSet")
conn.Open StrDSN
bh=request.form("txt1")
sql="select jfmx.dt_rq,jfmx.n_jfje,jfmx.c_yhls from jfmx,yhzl where jfmx.c_yh=yhzl.c_yh and jfmx.n_jfbz=1 and yhzl.c_bh='" & bh & "'"

rs.open sql,conn,1,1

if rs.eof then
response.write "no record at all"
elseif not rs.eof then
response.write "<html>"
response.write "<body>"
response.write "<form>"
response.write "<table border=1>"
response.write "<tr>"
for i=0 to rs.fields.count-1
response.write "<td><font color=blue>"&rs.Fields(i).Name&"</font></td>"
next
response.write "</tr>"
while not rs.EOF
response.write "<tr>"
for i=0 to rs.Fields.Count-1
response.write "<td>"&rs.Fields(i).Value&"</td>"
next
response.write "</tr>"
rs.MoveNext
wend
response.write "</table>"
response.write "</form>"
response.write "</body>"
response.write "</html>"
%>

然后是query.htm的全部代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<form name="form1" method="post" action="query.asp">
<p>编号:
<input type="text" name="txt1">
</p>
<p>
<input type="submit" name="Submit" value="查询">
</p>
</form>
</body>
</html>


运行的时候,单击“查询”,就出现下载保存的对话框,这是为什么呀?
yb2008 2004-10-19
  • 打赏
  • 举报
回复
有没有做表单呀!
cailover 2004-10-19
  • 打赏
  • 举报
回复
你把查询语句写在另一个页面中试试!
itzhiren 2004-10-19
  • 打赏
  • 举报
回复
这到底是为什么?
aoenzh 2004-10-19
  • 打赏
  • 举报
回复
???????
itzhiren 2004-10-19
  • 打赏
  • 举报
回复
???????

28,391

社区成员

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

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