ASP查询问题

rollin5460 2008-12-02 10:02:32
我在用ASP做一个查询页面,查询主要是根据文件名和项目来查询数据库,我遇到的问题是点了查询没有反应。好像得不到getdocno,getrev,getproject的值,请大家帮我看看,到底是什么问题呀。谢谢啦!
<%
getdocno=Trim(Request.querystring("getdocno"))
getrev=Trim(Request.querystring("getrev"))
getproject=Trim(Request.querystring("getproject"))
page=clng(request("page"))
if page<1 then page=1
if page>rs.recordcount then page=rs.recordcount
Set rs=CreateObject("ADODB.RecordSet")
sql="Select * from doclist where Doc_no like '%"& getdocno &"%' and Project like '%"& getproject &"%' "

if getrev<>"" then
sql=sql & " and Rev="& getrev
end if
rs.Open sql,conn,1,1
rs.movefirst
If Not rs.EOF Then
rs.Pagesize=15
rs.Absolutepage=Page
End If


%>
...全文
98 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
rollin5460 2008-12-02
  • 打赏
  • 举报
回复
呵呵,谢谢,问题解决了,居然就是那个按钮的问题。
sy_binbin 2008-12-02
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- #include file="conn.asp" -->
<!--#include file="Function.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DCC Database System </title>

</head>
<%
docid=request("id")
if docid <>"" then
conn.execute "delete from doclist where ID="& docid
end if
%>

<%
getdocno=Trim(Request("getdocno"))
getrev=Trim(Request("getrev"))
getproject=Trim(Request("getproject"))

page=clng(request("page"))
if page <1 then page=1
if page>rs.recordcount then page=rs.recordcount
Set rs=CreateObject("ADODB.RecordSet")
sql="Select * from doclist where Doc_no like '%"& getdocno &"%' and Project like '%"& getproject &"%' "

if getrev <>"" then
sql=sql & " and Rev="& getrev
end if
rs.Open sql,conn,1,1
rs.movefirst
If Not rs.EOF Then
rs.Pagesize=15
rs.Absolutepage=Page
End If


%>
<body>
<form id="myform" name="myform" method="post" action="">
<table width="970" border="0" cellspacing="0" cellpadding="0" align="center" height="269" >
<tr>
<td height="260" valign="bottom" bordercolor="#9966CC" background="images/top.jpg">
<table width="700" border="0" align="right" cellpadding="0" cellspacing="0" height="19">
<tr>
<td width="109" height="19" align="center" valign="middle"> <b> <a href="newdoc.asp">
New DOC </a> </b> </td>
<td width="101" height="19" align="center" valign="middle"> <b>
<a href="editdoc.asp">Edit DOC </a> </b> </td>
<td width="123" height="19" align="center" valign="middle">search </td>
<td width="104" height="19" align="center" valign="middle">history </td>
<td width="146" height="19" align="center" valign="middle">chang
password </td>
<td width="107" height="19">  </td>
</tr>
</table> </td>
</tr>
<tr>
<td height="9" align="center" valign="top" background="images/line.jpg">

<table border="0" width="96%" id="table1" height="176">
<tr>
<td height="67">
<table border="0" width="100%" id="table2" height="75">
<tr>
<td height="37" align="left">
<img border="0" src="images/ico02.gif" width="32" height="32"> <font size="4" color="#9999FF">
<b>Edit Document </b> </td>
</tr>
<tr>
<td bgcolor="#E7F0FA" align="left" >    <b>
<font color="#FF0000">Doc_no: </font> </b> <font size="3"> <input type="text" name="getdocno" size="20" > </font> <b>  Rev: </b> <font size="3"> <input name="getrev" type="text" size="5"> </font> <b>  
<font color="#FF0000">Project: </font> </b> <font size="3">
<select size="1" name="getproject">
<option selected>N/A </option>
<%
Dim rsPro,ProName,selProName
Set rsPro=Server.CreateObject("ADODB.RecordSet")
selProName=Request("selProName")
rsPro.Open "select * from project_info order by project asc",conn,1,1
ProName=""
rsPro.movefirst
IF rsPro.EOF Then
Response.Write " <option>No record in the database! </option>"
Else
Do while not rsPro.EOF
IF trim(rsPro("project")) <>ProName Then '重复记录判断
IF selProName=trim(rsPro("project")) Then '判断上一次选中的项目
Response.Write " <option selected "
Response.Write "value='"&rsPro("project")&"' >"
Response.Write rsPro("project")&" </option>"
Else
Response.Write " <option value='"&rsPro("project")&"' >"
Response.Write rsPro("project")&" </option>"
End IF
ProName=rsPro("project")
End IF
rsPro.MoveNext
Loop
End IF
rsPro.Close
Set rsPro=Nothing

%>

</select> </font> <b>   
</b> <font size="3">
<input type="submit" value="Search" name="search">
</font> </td>
</tr>
</table>
<table border="0" width="100%" id="table3">
<tr>
<td align="right">
<%PageBreak Page,"editdoc.asp?docno="&getdocno&"&rev="&getrev&"&project="&getproject&"&",rs%>
  </td>
</tr>
</table>
</td>
</tr>


<tr>
<td>

<table border="0" width="100%" id="table4" height="66" style="border-style: solid; border-width: 2px" bordercolor="#000000">

<tr bgcolor="#9AA7ED" >
<td width="132" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Doc No </font> </b> </td>
<td width="24" height="18%"> <b>
<font color="#FFFFFF" size="2">Rev </font> </b> </td>
<td width="56" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Project </font> </b> </td>
<td width="74" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Model </font> </b> </td>
<td width="175" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Description </font> </b> </td>
<td width="115" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Effective Date </font> </b> </td>
<td width="113" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Obsolete Date </font> </b> </td>
<td width="24" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">DMR </font> </b> </td>
<td width="62" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Modify </font> </b> </td>
<td width="59" height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">Save as </font> </b> </td>
<td height="18%" align="center"> <b>
<font color="#FFFFFF" size="2">
Delete </font> </b> </td>
</tr>
<% for i=1 to rs.pagesize
%>

<tr bgcolor="#ececec" align="center" onMouseOver="this.bgColor='#B0E2FF'" onMouseOut="this.bgColor='#ececec'">
<td width="132"> <font size="2"> <%=rs("Doc_no")%>  </font> </td>
<td width="24"> <font size="2"> <%=rs("Rev")%>  </font> </td>
<td width="56"> <font size="2"> <%=rs("Project")%>  </font> </td>
<td width="74"> <font size="2"> <%=rs("Model")%>  </font> </td>
<td width="175"> <font size="2"> <%=rs("Description")%>  </font> </td>
<td width="115"> <font size="2"> <%=rs("Effective_Date")%>  </font> </td>
<td width="113"> <font size="2"> <%=rs("Obsolete_Date")%>  </font> </td>
<td width="24"> <font size="2"> <%=rs("DMR")%>  </font> </td>
<td width="62"> <font size="2"> <a href="updoc.asp?ID= <%=rs("ID")%>">Modify </a> </font> </td>
<td width="59" > <font size="2">Save as </font> </td>
<td > <font size="2" onclick="return del()"> <input type=hidden name=id value=" <%=request("id")%>"> <a href="editdoc.asp?ID= <%=rs("ID")%>">Delete </a> </font> </td>
</tr>
<%rs.MoveNext
if rs.eof then exit for
next%>


</table>
</td>
</tr>
</table>
  </tr>


<tr>
<td height="51"> <img src="images/copyright.jpg" width="990" height="51" > </td>
</tr>

</table>

</form>

</body>

</html>
rollin5460 2008-12-02
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- #include file="conn.asp" -->
<!--#include file="Function.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DCC Database System</title>

</head>
<%
docid=request("id")
if docid<>"" then
conn.execute "delete from doclist where ID="& docid
end if
%>

<%
getdocno=Trim(Request.querystring("getdocno"))
getrev=Trim(Request.querystring("getrev"))
getproject=Trim(Request.querystring("getproject"))
page=clng(request("page"))
if page<1 then page=1
if page>rs.recordcount then page=rs.recordcount
Set rs=CreateObject("ADODB.RecordSet")
sql="Select * from doclist where Doc_no like '%"& getdocno &"%' and Project like '%"& getproject &"%' "

if getrev<>"" then
sql=sql & " and Rev="& getrev
end if
rs.Open sql,conn,1,1
rs.movefirst
If Not rs.EOF Then
rs.Pagesize=15
rs.Absolutepage=Page
End If


%>
<body>
<form id="myform" name="myform" method="post" action="">
<table width="970" border="0" cellspacing="0" cellpadding="0" align="center" height="269" >
<tr>
<td height="260" valign="bottom" bordercolor="#9966CC" background="images/top.jpg">
<table width="700" border="0" align="right" cellpadding="0" cellspacing="0" height="19">
<tr>
<td width="109" height="19" align="center" valign="middle"><b><a href="newdoc.asp">
New DOC</a></b></td>
<td width="101" height="19" align="center" valign="middle"><b>
<a href="editdoc.asp">Edit DOC</a></b></td>
<td width="123" height="19" align="center" valign="middle">search</td>
<td width="104" height="19" align="center" valign="middle">history</td>
<td width="146" height="19" align="center" valign="middle">chang
password</td>
<td width="107" height="19"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="9" align="center" valign="top" background="images/line.jpg">

<table border="0" width="96%" id="table1" height="176">
<tr>
<td height="67">
<table border="0" width="100%" id="table2" height="75">
<tr>
<td height="37" align="left">
<img border="0" src="images/ico02.gif" width="32" height="32"> <font size="4" color="#9999FF">
<b>Edit Document</b></td>
</tr>
<tr>
<td bgcolor="#E7F0FA" align="left" >    <b>
<font color="#FF0000">Doc_no:</font></b><font size="3"><input type="text" name="getdocno" size="20" ></font><b>  Rev:</b><font size="3"><input name="getrev" type="text" size="5"></font><b>  
<font color="#FF0000">Project:</font></b><font size="3">
<select size="1" name="getproject">
<option selected>N/A</option>
<%
Dim rsPro,ProName,selProName
Set rsPro=Server.CreateObject("ADODB.RecordSet")
selProName=Request("selProName")
rsPro.Open "select * from project_info order by project asc",conn,1,1
ProName=""
rsPro.movefirst
IF rsPro.EOF Then
Response.Write "<option>No record in the database!</option>"
Else
Do while not rsPro.EOF
IF trim(rsPro("project"))<>ProName Then '重复记录判断
IF selProName=trim(rsPro("project")) Then '判断上一次选中的项目
Response.Write "<option selected "
Response.Write "value='"&rsPro("project")&"' >"
Response.Write rsPro("project")&"</option>"
Else
Response.Write "<option value='"&rsPro("project")&"' >"
Response.Write rsPro("project")&"</option>"
End IF
ProName=rsPro("project")
End IF
rsPro.MoveNext
Loop
End IF
rsPro.Close
Set rsPro=Nothing

%>

</select></font><b>   
</b><font size="3">
<input type="button" value="Search" name="search"></font></td>
</tr>
</table>
<table border="0" width="100%" id="table3">
<tr>
<td align="right">
<%PageBreak Page,"editdoc.asp?docno="&getdocno&"&rev="&getrev&"&project="&getproject&"&",rs%>
  </td>
</tr>
</table>
</td>
</tr>


<tr>
<td>

<table border="0" width="100%" id="table4" height="66" style="border-style: solid; border-width: 2px" bordercolor="#000000">

<tr bgcolor="#9AA7ED" >
<td width="132" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Doc No</font></b></td>
<td width="24" height="18%"><b>
<font color="#FFFFFF" size="2">Rev</font></b></td>
<td width="56" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Project</font></b></td>
<td width="74" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Model</font></b></td>
<td width="175" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Description</font></b></td>
<td width="115" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Effective Date</font></b></td>
<td width="113" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Obsolete Date</font></b></td>
<td width="24" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">DMR</font></b></td>
<td width="62" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Modify</font></b></td>
<td width="59" height="18%" align="center"><b>
<font color="#FFFFFF" size="2">Save as</font></b></td>
<td height="18%" align="center"><b>
<font color="#FFFFFF" size="2">
Delete</font></b></td>
</tr>
<% for i=1 to rs.pagesize
%>

<tr bgcolor="#ececec" align="center" onMouseOver="this.bgColor='#B0E2FF'" onMouseOut="this.bgColor='#ececec'">
<td width="132"><font size="2"><%=rs("Doc_no")%> </font></td>
<td width="24"><font size="2"><%=rs("Rev")%> </font></td>
<td width="56"><font size="2"><%=rs("Project")%> </font></td>
<td width="74"><font size="2"><%=rs("Model")%> </font></td>
<td width="175"><font size="2"><%=rs("Description")%> </font></td>
<td width="115"><font size="2"><%=rs("Effective_Date")%> </font></td>
<td width="113"><font size="2"><%=rs("Obsolete_Date")%> </font></td>
<td width="24"><font size="2"><%=rs("DMR")%> </font></td>
<td width="62"><font size="2"><a href="updoc.asp?ID=<%=rs("ID")%>">Modify</a></font></td>
<td width="59" ><font size="2">Save as</font></td>
<td ><font size="2" onclick="return del()"><input type=hidden name=id value="<%=request("id")%>"><a href="editdoc.asp?ID=<%=rs("ID")%>">Delete</a></font></td>
</tr>
<%rs.MoveNext
if rs.eof then exit for
next%>


</table>
</td>
</tr>
</table>
 </tr>


<tr>
<td height="51"><img src="images/copyright.jpg" width="990" height="51" ></td>
</tr>

</table>

</form>

</body>

</html>
sy_binbin 2008-12-02
  • 打赏
  • 举报
回复
你这个页面从哪转过来的
那个页面的代码贴一下
rollin5460 2008-12-02
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 sy_binbin 的回复:]
getdocno=Trim(Request("getdocno"))
getrev=Trim(Request("getrev"))
getproject=Trim(Request("getproject"))

你这样试试
[/Quote]我开始是这样,也不行。
rollin5460 2008-12-02
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 aspvfp 的回复:]
表单提交是get 还是post
地址栏上 getdocno,getrev,getproject 都有值吗

如果是 post 提交的 用 Request.form 读取
[/Quote]地址栏上getdocno,getrev,getproject都没有值,我不知道什么原因。
sy_binbin 2008-12-02
  • 打赏
  • 举报
回复
getdocno=Trim(Request("getdocno"))
getrev=Trim(Request("getrev"))
getproject=Trim(Request("getproject"))

你这样试试
aspvfp 2008-12-02
  • 打赏
  • 举报
回复
表单提交是get 还是post
地址栏上 getdocno,getrev,getproject 都有值吗

如果是 post 提交的 用 Request.form 读取
rollin5460 2008-12-02
  • 打赏
  • 举报
回复
大家帮帮我呀,不知道哪里出问题啦

28,409

社区成员

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

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