![]() |
#2
wangjy5002011-10-30 16:53
|
我刚用DW VBSCRIPT做了个ASP。通过两个下拉菜单查询数据库中的内容,可是SQL语句总是不显示结果。

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/test.asp" -->
<%
Dim Recordset2
Dim Recordset2_numRows
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_test_STRING
Recordset2.Source = "SELECT * FROM 表1"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()
Recordset2_numRows = 0
Recordset1_numRows = 0
lx=request.form("select")
lw=request.form("select2")
sql="select 名称 from 表1 where 性质1="&lx&" and 性质2="&lw&"" 查询为什么不出结果而是直接把语句显示出来了呢???
response.write (sql)
[local]1[/local]
=====================================================================以下是窗体部分
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:574px;
height:313px;
z-index:1;
left: 36px;
top: 195px;
}
#Layer2 {
position:absolute;
width:827px;
height:564px;
z-index:1;
left: 314px;
top: 191px;
}
-->
</style>
</head>
<body>
<div id="Layer2">
<form id="form1" name="form1" method="post" action="测试半成功.asp">
<label> </label>
<label></label>
<p>
<label></label>
<label></label>
<select name="select">
<option value="-1">有</option>
<option value="0">无</option>
</select>
</p>
<p>
<label></label>
<label>
<select name="select2">
<option value="-1">有</option>
<option value="0">无</option>
</select>
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
</div>
</html>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
<!--#include file="Connections/test.asp" -->
<%
Dim Recordset2
Dim Recordset2_numRows
Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_test_STRING
Recordset2.Source = "SELECT * FROM 表1"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()
Recordset2_numRows = 0
Recordset1_numRows = 0
lx=request.form("select")
lw=request.form("select2")
sql="select 名称 from 表1 where 性质1="&lx&" and 性质2="&lw&"" 查询为什么不出结果而是直接把语句显示出来了呢???
response.write (sql)
[local]1[/local]
=====================================================================以下是窗体部分
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:574px;
height:313px;
z-index:1;
left: 36px;
top: 195px;
}
#Layer2 {
position:absolute;
width:827px;
height:564px;
z-index:1;
left: 314px;
top: 191px;
}
-->
</style>
</head>
<body>
<div id="Layer2">
<form id="form1" name="form1" method="post" action="测试半成功.asp">
<label> </label>
<label></label>
<p>
<label></label>
<label></label>
<select name="select">
<option value="-1">有</option>
<option value="0">无</option>
</select>
</p>
<p>
<label></label>
<label>
<select name="select2">
<option value="-1">有</option>
<option value="0">无</option>
</select>
</label>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form>
</div>
</html>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>