| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2692 人关注过本帖
标题:[求助]当查询条件为空的时候,弹出MsgBox警告该怎么呀?
只看楼主 加入收藏
sm105096496
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2007-7-11
收藏
得分:0 
看看你的代码 一定是逻辑问题 自己想下 或者复制上来看下 有时间就帮你看下
2007-07-12 15:56
ASP汽车
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2007-7-4
收藏
得分:0 

<%response.Buffer=true%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>需求单系统查询</title>
</head>
<!--#include file="conn.asp"-->
<script type="text/javascript" src="calendar.js"></script>
<%
dim MAJOR_IDEA,APPLY_TIME_start,APPLY_TIME_END,WISH_FINISH_TIME_start,WISH_FINISH_TIME_END,IT_UNDERTAKER,PHASE

MAJOR_IDEA=Trim(request.form("MAJOR_IDEA"))
APPLY_TIME_start=Trim(request.form("APPLY_TIME_start"))
APPLY_TIME_end=Trim(request.form("APPLY_TIME_end"))
WISH_FINISH_TIME_start=Trim(request.form("WISH_FINISH_TIME_start"))
WISH_FINISH_TIME_end=Trim(request.form("WISH_FINISH_TIME_end"))
IT_UNDERTAKER=Trim(request.form("IT_UNDERTAKER"))
PHASE=Trim(request.form("PHASE"))


sql="select APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO where 1=1"

if len(MAJOR_IDEA)>1 then
sql=sql &" and MAJOR_IDEA like '%"& MAJOR_IDEA &"%'"
end if

if len(APPLY_TIME_start)>1 then
sql=sql &" and APPLY_TIME >='"& APPLY_TIME_start &"'"
end if

if len(APPLY_TIME_end)>1 then
sql=sql&" and APPLY_TIME <='"& APPLY_TIME_end &"'"
end if


if len( WISH_FINISH_TIME_start)>1 then
sql=sql&" and WISH_FINISH_TIME >='"& WISH_FINISH_TIME_start &"'"
end if

if len(WISH_FINISH_TIME_end)>1 then
sql=sql&" and APPLY_TIME <='"& WISH_FINISH_TIME_end &"'"
end if

if len(IT_UNDERTAKER)>1 then
sql=sql&" and IT_UNDERTAKE = '"& IT_UNDERTAKE &"'"
end if

if len(PHASE)>3 then
sql=sql&" and PHASE='"& PHASE &"'"
end if
Set Rs = server.CreateObject("Adodb.Recordset")
Rs.open SQL,CONN,1,1
if not rs.eof and not rs.bof then
nAPPLY_DEPARTMENT=trim(rs.fields("APPLY_DEPARTMENT"))
nAPPLIER=trim(rs.fields("APPLIER"))
nMAJOR_IDEA=trim(rs.fields("MAJOR_IDEA"))
nIT_UNDERTAKER=trim(rs.fields("IT_UNDERTAKER"))
nAPPLY_TIME=trim(rs.fields("APPLY_TIME"))
nWISH_FINISH_TIME=trim(rs.fields("WISH_FINISH_TIME"))
nTOTESTTIME=trim(rs.fields("TOTESTTIME"))
nPHASE=trim(rs.fields("PHASE"))
else
response.Write("需求单不存在")
end if
rs.close
' nAPPLY_DEPARTMENT=""
' nAPPLIER=""
' nMAJOR_IDEA=""
' nIT_UNDERTAKER=""
' nAPPLY_TIME=""
' nWISH_FINISH_TIME=""
' nTOTESTTIME=""
' nPHASE=""
' response.Write sql

%>

<body>
<form action="dispose_demand.asp" method="post" name="dispose_demand">
<table width="852" border="1" align="center">
<tr>
<td width="115" height="48">需求主旨:</td>
<td colspan="3"><label>
<input type="text" id="MAJOR_IDEA" name="MAJOR_IDEA" value='<%=request.form("MAJOR_IDEA")%>' size="65" maxlength="65" />

</label></td>
</tr>
<tr>
<td height="43">需求单提出日期:</td>
<td width="305"><label>
<input onFocus="calendar()" name="APPLY_TIME_start" type="text" id="APPLY_TIME_start" value='<%=request.form("APPLY_TIME_start")%>' />
</label></td>
<td width="87">至: </td>
<td width="317"><label>
<input onFocus="calendar()" name="APPLY_TIME_END" type="text" id="Calendar1" value='<%=request.form("APPLY_TIME_end")%>'/>
</label></td>
</tr>
<tr>
<td height="35">希望上线时间:</td>
<td><label>
<input onFocus="calendar()" name="WISH_FINISH_time_start" type="text" id="Calendar1" value='<%=request.form("WISH_FINISH_time_start")%>' />
</label></td>
<td>至:</td>
<td><label>
<input onFocus="calendar()" name="WISH_FINISH_time_END" type="text" id="Calendar1" value='<%=request.form("WISH_FINISH_time_end")%>' />
</label></td>
</tr>
<tr>
<td height="42">资讯主办:</td>
<td><label>
<input name="IT_UNDERTAKER" type="text" size="30" value='<%=request.form("IT_UNDERTAKER")%>' />
</label></td>
<td>需求状态:</td>
<td><label>
<select name="PHASE" value='<%=request.form("PHASE")%>' >
<option selected="selected">请选择</option>
<option value="提单审核">提单审核</option>
<option value="效益评估">效益评估</option>
<option value="需求确认">需求确认</option>
<option value="系统分析">系统分析</option>
<option value="系统开发">系统开发</option>
<option value="系统测试">系统测试</option>
<option value="用户测试">用户测试</option>
<option value="达成目标">达成目标</option>
<option value="正式上线">正式上线</option>
</select>
</label></td>
</tr>
<tr>
<td height="41" colspan="4">查询条件选择
<label>
<input type="submit" name="select1" value="查询" />
<input type="reset" value="重置" />
</label></td>
</tr>
</table>
</tr>
</table>
<tr><td colspan=4 width="600" height="10"><input name=flag type=hidden value=""></td></tr>
<TABLE cellPadding=1 align="center" cellSpacing=1 align=center border=1 width="900" height="1" >
<%
response.write"<tr>"
response.write"<td width=100> 需求单位 </td>"
response.write"<td width=100> 需求提出人 </td>"
response.write"<td width=100> 主旨 </td>"
response.write"<td width=100> 资讯主办 </td>"
response.write"<td width=100> 需求提出日期</td>"
response.write"<td width=100> 希望上线日期 </td>"
response.write"<td width=100> 预估完成日期 </td>"
response.write"<td width=100> 状态</td>"
response.write"<td width=100> 说明</td></tr>"

Set Rs = server.CreateObject("Adodb.Recordset")
'sql="select APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO "

sql="select APPLY_DEPARTMENT,APPLIER,MAJOR_IDEA,IT_UNDERTAKER,APPLY_TIME,WISH_FINISH_TIME,TOTESTTIME,REQUIRE_ESTI.PHASE from songzw.REQUIRE_BILL inner join REQUIRE_ESTI on songzw.REQUIRE_BILL.IT_NO=REQUIRE_ESTI.IT_NO where 1=1"

if len(MAJOR_IDEA)>1 then
sql=sql &" and MAJOR_IDEA like '%"& MAJOR_IDEA &"%'"
end if

if len(APPLY_TIME_start)>1 then
sql=sql &" and APPLY_TIME >='"& APPLY_TIME_start &"'"
end if

if len(APPLY_TIME_end)>1 then
sql=sql&" and APPLY_TIME <='"& APPLY_TIME_end &"'"
end if


if len( WISH_FINISH_TIME_start)>1 then
sql=sql&" and WISH_FINISH_TIME >='"& WISH_FINISH_TIME_start &"'"
end if

if len(WISH_FINISH_TIME_end)>1 then
sql=sql&" and APPLY_TIME <='"& WISH_FINISH_TIME_end &"'"
end if

if len(IT_UNDERTAKER)>1 then
sql=sql&" and IT_UNDERTAKE = '"& IT_UNDERTAKE &"'"
end if

if len(PHASE)>3 then
sql=sql&" and PHASE='"& PHASE &"'"
end if
Rs.open SQL,CONN,1,1
if Not rs.Eof then Rs.MoveFirst

Do while Not rs.Eof
nAPPLY_DEPARTMENT=trim(rs.fields("APPLY_DEPARTMENT"))
nAPPLIER=trim(rs.fields("APPLIER"))
nMAJOR_IDEA=trim(rs.fields("MAJOR_IDEA"))
nIT_UNDERTAKER=trim(rs.fields("IT_UNDERTAKER"))
nAPPLY_TIME=trim(rs.fields("APPLY_TIME"))
nWISH_FINISH_TIME=trim(rs.fields("WISH_FINISH_TIME"))
nTOTESTTIME=trim(rs.fields("TOTESTTIME"))
nPHASE=trim(rs.fields("PHASE"))


response.write"<tr>"
response.write"<td width=100>" & nAPPLY_DEPARTMENT & "</td>"
response.write"<td width=100>" & nAPPLIER & "</td>"
response.write"<td width=100>" & nMAJOR_IDEA & "</td>"
response.write"<td width=100>" & nIT_UNDERTAKER & "</td>"
response.write"<td width=100>" & nAPPLY_TIME & "</td>"
response.write"<td width=100>" & nWISH_FINISH_TIME & "</td>"
response.write"<td width=100>" & nTOTESTTIME & "</td>"
response.write"<td width=100>" & nPHASE & "</td></tr>"
Rs.MoveNext
Loop
%>

</table>
</form>
</body>
</html>
<script language="vbscript">
dispose_demand.nAPPLY_DEPARTMENT.value="<%=nAPPLY_DEPARTMENT%>"
dispose_demand.nAPPLIER.value="<%=nAPPLIER%>"
dispose_demand.nMAJOR_IDEA.value="<%=nMAJOR_IDEA%>"
dispose_demand.nIT_UNDERTAKER.value="<%=nIT_UNDERTAKER%>"
dispose_demand. nAPPLY_TIME.value="<%= nAPPLY_TIME%>"
dispose_demand.nWISH_FINISH_TIME.value="<%=nWISH_FINISH_TIME%>"
dispose_demand.nTOTESTTIME.value="<%=nTOTESTTIME%>"
dispose_demand.nPHASE.value="<%=nPHASE%>"

</script>
<script language="vbscript" >
sub select1_onclick
if dispose_demand.MAJOR_IDEA.value="" and dispose_demand.APPLY_TIME_start.value="" and dispose_demand.APPLY_TIME_end.value="" and dispose_demand.WISH_FINISH_TIME_start.value="" and dispose_demand.WISH_FINISH_TIME_END.value="" and dispose_demand.IT_UNDERTAKER.value="" and dispose_demand.PHASE.value="" then
MsgBox "查询条件不能为空,至少需要输入一个查询条件!",78,"需求单系统查询"
dispose_demand.MAJOR_IDEAE.focus
dispose_demand.APPLY_TIME_start.focus
dispose_demand.APPLY_TIME_end.focus
dispose_demand.WISH_FINISH_TIME_start.focus
dispose_demand.WISH_FINISH_TIME_end.focus
dispose_demand.IT_UNDERTAKER.focus
dispose_demand.PHASE.focus
exit sub
end if
maintenance.flag.value="Q"
dispose_demand.submit
end sub
</script>
<%
set Rs=nothing
Conn.close
Set Conn=nothing
%>


学习ASP中.....难啊......
2007-07-12 16:06
ASP汽车
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2007-7-4
收藏
得分:0 


写的很乱


学习ASP中.....难啊......
2007-07-12 16:07
sm105096496
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2007-7-11
收藏
得分:0 
<script>
function show()
{
IT_UNDERTAKER.value="";

}
</script>
<input name="IT_UNDERTAKER" type="text" size="30" value='ds' />
<input type="submit" name="select1" value="查询" />
<input type="reset" value="重置" onClick="show()"/>

我写了一个打比方 看你的真的好累要是可以你就用吧
不行就算了
2007-07-12 16:36
sm105096496
Rank: 1
等 级:新手上路
帖 子:58
专家分:0
注 册:2007-7-11
收藏
得分:0 

不知道你解决了没 ??

2007-07-12 17:04
ASP汽车
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2007-7-4
收藏
得分:0 
楼上的可爱的人,我明天去公司试试哈,不过看去是应该可以实现滴,好聪明的你哟~~~~~~~~~~

学习ASP中.....难啊......
2007-07-12 20:44
ASP汽车
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2007-7-4
收藏
得分:0 

<input type="reset" value="重置" onClick="show()" />
<script>
function show()
{
MAJOR_IDEAE.value=""
APPLY_TIME_start.value=""
APPLY_TIME_end.value=""
WISH_FINISH_TIME_start.value=""
WISH_FINISH_TIME_end.value=""
IT_UNDERTAKER.value=""
PHASE.value=""
}
</script>

这样写还是不行哦,网页显示出来,但是在下面会提示网页上有错误~

学习ASP中.....难啊......
2007-07-13 08:12
udbyygy
Rank: 1
等 级:新手上路
威 望:2
帖 子:226
专家分:0
注 册:2007-6-26
收藏
得分:0 
document.dispose_demand.major_ideae.value=""

2007-07-13 08:32
ASP汽车
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2007-7-4
收藏
得分:0 
还是不行~

学习ASP中.....难啊......
2007-07-13 09:02
yndkai
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:275
专家分:0
注 册:2007-6-1
收藏
得分:0 

<Script Language="JavaScript">
function zmbn()
{
window.document.form1.user.value='';
window.document.form1.password.value='';
}
</Script>

<body>
<form action="" method="post" name="form1">
<input type="text" name="user" value="111">
<input type="password" name="password" value="">
<input type="submit" value="查询">
<input type="reset" value="111" onClick="zmbn(); return false;">
</form>
</body>

参考一下这个


本来讨厌下雨的天空 直到听见有人说爱我
2007-07-13 09:45
快速回复:[求助]当查询条件为空的时候,弹出MsgBox警告该怎么呀?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026990 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved