多表单查询问题

zychenzy 2005-04-27 10:59:56
A条件 查询
B条件 查询(B中的条件包含A)
C条件 查询(C中的条件包含A和B)
这三个条件都放在一个页面里,点查询开始查询。
怎么做!!分不多,感激了!
...全文
128 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
<input name=i1>
<a href="javascript:liu(i)">xxx</a>
function liu(i){
document.all.form1.action="你处理的页面?kind="+i;
document.all.form1.submit();
}
</script>
提交页
<%
'接收页
kind=request("kind")
select case kind
case 1
.......
case 2
......
case 3
......
end select
%>
scoutlin 2005-04-27
  • 打赏
  • 举报
回复
<form name=form1 action="1.asp">
<input name=i1>
<input type=submit name="s" value="查询1">
<br>
<input name=i2>
<input type=submit name="s" value="查询2">
<br>
<input name=i3>
<input type=submit name="s" value="查询3">
<br>
</form>

<%
i1=request("i1")
i2=request("i2")
i3=request("i3")
select case request("s")
case "查询1"
sql="select * from table where i1='"&i1&"'"
case "查询2"
sql="select * from table where i1='"&i1&"' and i2="&i2&"'"
case "查询3"
sql="select * from table where i1='"&i1&"' and i2='"&i2&"' and i3='"&i3&"'"
end select
....
'差不多象这样,自己再修改一下
%>
zychenzy 2005-04-27
  • 打赏
  • 举报
回复
A条件 查询(按钮)

A条件 B条件 查询(按钮)(B中的条件包含A)

A条件 B条件 C条件 查询(按钮)(C中的条件包含A和B)
这三个查询在一个页面,每个查询提交一次,相对独立,但是我又不想在第二个查询里面列出条件A,当然查询时要用它做条件。如何解决。
HHH3000 2005-04-27
  • 打赏
  • 举报
回复
晕呼~~
没听明白~~
zychenzy 2005-04-27
  • 打赏
  • 举报
回复
我的意思是,在一个版面里有多个查询,也就有多个提交按钮。
查询条件有重复的,而我又不想让用户看到重复的条件。
chang1216 2005-04-27
  • 打赏
  • 举报
回复

if thisgroupcount=0 then
aalist =aalist & "<option>" & thisvalue & "</option>" & vbcrlf
end if

if thissubgroupcount=0 then
tempSTR3=tempSTR3 & "// " & lastvalue2 & vbcrlf
end if

tempSTR3=TempSTR3 & "key1[" & howmanygroups & "][" & howmanysubgroups & "][" & thissubgroupcount & "]=""" & thisvalue3 & """;" & vbCRLF

if howmanygroups=0 then
If thissubgroupcount=0 then
sslist = sslist & "<option>" & thisvalue2 & "</option>" & vbcrlf
end if
End If

if howmanygroups=0 then
if howmanysubgroups=0 then
ddlist = ddlist & "<option>" & thisvalue3 & "</option>" & vbcrlf
end if
End if

thisgroupcount=thisgroupcount+1
thissubgroupcount=thissubgroupcount+1
lastvalue=thisvalue
loopcounter=loopcounter+1
Re.movenext

LOOP
tempSTR=tempSTR & "key[" & howmanygroups & _
"]=new Array(" & howmanysubgroups+1 & ");" & _
vbcrlf
tempSTR=tempSTR & "key1[" & howmanygroups & _
"]=new Array(" & howmanysubgroups+1 & ");" & _
vbcrlf

tempSTR2=TempSTR2 &"key1[" & howmanygroups & "][" & howmanysubgroups & "]=new Array(" & thissubgroupcount & ");" & _
vbcrlf
tempSTR1= TempSTR1 & "key[" & howmanygroups & "][" & howmanysubgroups & "]=""" & lastvalue2 & """;" & vbCRLF
tempSTR=tempSTR & TempSTR1 & TempSTR2 & tempSTR3

aalist=aalist & "</select>"

sslist= sslist & "</select>"

ddlist= ddlist & "</select>"


myevent=vbcrlf & "key=new Array(" & howmanygroups+1 & ");"
myevent=myevent & vbcrlf & "key1=new Array(" & howmanygroups+1
myevent=myevent & ");" & vbcrlf & tempSTR




tempSTR =vbcrlf & "function Buildkey" & "(num)" & vbcrlf
tempSTR =tempSTR & "{" & vbcrlf
tempSTR =tempSTR & "Buildkey1(0);" & vbcrlf
tempSTR =tempSTR & "document." & myForm & "."
tempSTR =tempSTR & listname2 & ".selectedIndex=0;" & vbcrlf
tempSTR =tempSTR & "for(ctr=0;ctr<key[num].length;ctr++)" & vbcrlf
tempSTR =tempSTR & "{" & vbcrlf
tempSTR =tempSTR & "document." & myform & "." & listname2
tempSTR =tempSTR & ".options[ctr]=new Option(key[num][ctr],"
tempSTR =tempSTR & "key[num][ctr]);" & vbcrlf
tempSTR =tempSTR & "}" & vbcrlf
tempSTR =tempSTR & "document." & myForm & "." & listname2
tempSTR =tempSTR & ".length=key[num].length;" & vbcrlf
tempSTR =tempSTR & "}" & vbcrlf

tempSTR =tempSTR & vbcrlf & "function Buildkey1" & "(num)" & vbcrlf
tempSTR =tempSTR & "{" & vbcrlf
tempSTR =tempSTR & "document." & myForm & "."
tempSTR =tempSTR & listname3 & ".selectedIndex=0;" & vbcrlf
tempSTR =tempSTR & "for(ctr=0;ctr<key1[document.myForm.menu1.selectedIndex][num].length;ctr++)" & vbcrlf
tempSTR =tempSTR & "{" & vbcrlf
tempSTR =tempSTR & "document." & myform & "." & listname3
tempSTR =tempSTR & ".options[ctr]=new Option(key1[document.myForm.menu1.selectedIndex][num][ctr],"
tempSTR =tempSTR & "key1[document.myForm.menu1.selectedIndex][num][ctr]);" & vbcrlf
tempSTR =tempSTR & "}" & vbcrlf
tempSTR =tempSTR & "document." & myForm & "." & listname3
tempSTR =tempSTR & ".length=key1[document.myForm.menu1.selectedIndex][num].length;" & vbcrlf
tempSTR =tempSTR & "}" & vbcrlf
myfun=tempSTR


END sub
%>
</body>
</html>
<%
Re.Close()
%>
把这两段 连在一起 然后改一下 sql语句就可以了
chang1216 2005-04-27
  • 打赏
  • 举报
回复
<%
set Re = Server.CreateObject("ADODB.Recordset")
Re.ActiveConnection = conn
Re.Source = "select distinct (year(datetime)),(month(datetime)),(day(datetime)) from salt_water_day"
Re.CursorType = 0
Re.CursorLocation = 2
Re.LockType = 3
Re.Open()
Re_numRows = 0
%>
<%
CALL listmaker(aalist,"menu1", sslist ,"menu2", ddlist, "menu3", pubevent, pubfun, "myForm")
%>

<table width="412" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td width="82"> <div align="left"><font size="2">请选择:
年</font></div>
<div align="left"><font size="2"> </font></div></td>
<td width="22"><font size="2"><%= aalist%></font></td>
<td width="20">月</td>
<td width="38"><font size="2"><%= sslist%></font></td>
<td width="27">日</td>
<td width="46"><font size="2"><%= ddlist%></font></td>
<td width="135"><font size="2">
<input type=submit value="提交" name="submit2">
</font></td>
</tr>
</table>

<SCRIPT Language="JavaScript"><!--

<%=pubevent%>
<%=pubfun%>
--></Script>
<%

SUB listmaker(byref list1, listname1, byref list2, listname2, byref list3, listname3, byref myevent, byref myfun, myForm)
aalist="<select name=" & listname1
aalist=aalist & " OnChange=""Buildkey"
aalist=aalist & "(this.selectedIndex);"">"
sslist="<select name=" & listname2
sslist=sslist & " OnChange=""Buildkey1"
sslist=sslist & "(this.selectedIndex);"">"
ddlist="<select name=" & listname3 & ">"
loopcounter=0
lastvalue=Re(0)
lastvalue2=Re(1)
redim tempArray(1)
thisgroupcount=0
thissubgroupcount=0
howmanygroups=0
howmanysubgroups=0
DO UNTIL Re.eof
thisvalue=Re(0)
thisvalue2=Re(1)
thisvalue3=Re(2)

if thisvalue2<>lastvalue2 then
If howmanysubgroups=0 then
tempSTR1=tempSTR1 & "// " & lastvalue & vbcrlf
tempSTR2=tempSTR2 & "// " & lastvalue & vbcrlf
end If
tempSTR2=tempSTR2 & "key1[" & howmanygroups & "][" & howmanysubgroups & "]=new Array(" & thissubgroupcount & ");" &vbcrlf
tempSTR1=tempSTR1 & "key[" & howmanygroups & "][" & howmanysubgroups &"]=""" & lastvalue2 & """;" & vbCRLF
howmanysubgroups=howmanysubgroups+1
thissubgroupcount=0
lastvalue2=thisvalue2
end if

if thisvalue<>lastvalue then
tempSTR=tempSTR & "key[" & howmanygroups & "]=new Array(" & howmanysubgroups & ");" & _
vbcrlf
tempSTR=tempSTR & "key1[" & howmanygroups & "]=new Array(" & howmanysubgroups & ");" & _
vbcrlf
thisgroupcount=0
howmanygroups=howmanygroups+1
howmanysubgroups=0
end if
chang1216 2005-04-27
  • 打赏
  • 举报
回复
你的意思 是联动菜单吧 如果是 我这里有非常好用的代码
  • 打赏
  • 举报
回复
这个就是一个提交啊,你那里有不懂的地方??
zlj113 2005-04-27
  • 打赏
  • 举报
回复
听得很晕,

说清楚点吧
zychenzy 2005-04-27
  • 打赏
  • 举报
回复
刚才忙别的去了,一会调试,过了就给分。谢谢各位了!!

28,406

社区成员

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

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