查询的问题(7.6)

adron 2001-07-06 11:26:50
各位帮忙看一下,那里有问题:
table_renli=" from renli"

Set cn=Server.CreateObject("Adodb.Connection")
Set rs=Server.CreateObject("Adodb.RecordSet")
cn.Open dsn,uid,pwd
%>
<form method="post" action="renli/renli.asp">
record:<input type="text" name="record">
<input type="submit" value="enter">
</form>
<%record=request.form("record")%>
<%
sql="select "&record&table_renli
...
当打开页面,输入查询条件后,显示结果。
...全文
153 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
gq 2001-07-06
  • 打赏
  • 举报
回复
在哪里出错?错误提示是什么?
adron 2001-07-06
  • 打赏
  • 举报
回复
<table r border="0">
<tr><th colspan=3> 人员信息查询结果</th>
<tr><th>索引</th> <th>姓名</th> <th>性别</th>

<%
dsn="renliu"
uid="renliuser"
pwd="renlipas"
table_renli=" from renli"

Set cn=Server.CreateObject("Adodb.Connection")
Set rs=Server.CreateObject("Adodb.RecordSet")
cn.Open dsn,uid,pwd
%>
<form method="post" action="renli/renli.asp">
record:<input type="text" name="record">
<input type="submit" value="enter">
</form>
<%record=request.form("record")%>
<%
sql="select "&record&table_renli

rs.Open sql,cn,1,1
do while not rs.eof
'index=rs("index")
name=rs("name")
'sex=rs("sex")
%>

<tr><th><%=index%></th><th><%=name%></th><th><%=sex%></th></tr>

<%
rs.movenext
loop
Set cn=Nothing
Set rs=Nothing
%>

</table>
测试输入name
adron 2001-07-06
  • 打赏
  • 举报
回复
<table r border="0">
<tr><th colspan=3> 人员信息查询结果</th>
<tr><th>索引</th> <th>姓名</th> <th>性别</th>

<%
dsn="renliu"
uid="renliuser"
pwd="renlipas"
table_renli=" from renli"

Set cn=Server.CreateObject("Adodb.Connection")
Set rs=Server.CreateObject("Adodb.RecordSet")
cn.Open dsn,uid,pwd
%>
<form method="post" action="renli/renli.asp">
record:<input type="text" name="record">
<input type="submit" value="enter">
</form>
<%record=request.form("record")%>
<%
sql="select sex"&table_renli

rs.Open sql,cn,1,1
do while not rs.eof
'index=rs("index")
'name=rs("name")
sex=rs("sex")
%>

<tr><th><%=index%></th><th><%=name%></th><th><%=sex%></th></tr>

<%
rs.movenext
loop
Set cn=Nothing
Set rs=Nothing
%>

</table>
gq 2001-07-06
  • 打赏
  • 举报
回复
把完整代码贴出来。还有出的是什么错误?
adron 2001-07-06
  • 打赏
  • 举报
回复
如果,没有要求输入,把sql直接付为查询语句,结果是对的。
现在的问题可不可能是还未得到完整的sql,就直接到数据库里查了?我在上述语句后直接是查询:rs.Open sql,cn,1,1
do while not rs.eof
'index=rs("index")
name=rs("name")
'sex=rs("sex")
%>

<tr><th><%=index%></th><th><%=name%></th><th><%=sex%></th></tr>

<%
rs.movenext
loop
Set cn=Nothing
Set rs=Nothing
或者是<form method="post" action="renli/renli.asp">这句话有问题。renli文件夹在根目录下
dotnba 2001-07-06
  • 打赏
  • 举报
回复
你先将SQL输出看是否正确。
gq 2001-07-06
  • 打赏
  • 举报
回复
sql="select * " &table_renli &" where ****='" &record &"'"
gq 2001-07-06
  • 打赏
  • 举报
回复
sql="select * " &table_renli &"where ****='" &record &"'"
adron 2001-07-06
  • 打赏
  • 举报
回复
<%record=request.form("record")%>
问题出在这句上。问题已解决!因为没有使用session!
adron 2001-07-06
  • 打赏
  • 举报
回复
record:<input type="text" name="record">
问题出在这句上。问题已解决!

28,390

社区成员

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

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