主题:如何执行else前时候sql
各位,我提交了查询条件。
<%=bumen%>
bumen 等于0
但是还是执行else后的sql
如何写在才能执行前面的sql ,我的写法错在那里
<%! String sql="";
String xingming="";
String dianhua="";
String bumen="";
%>
<%
xingming=request.getParameter("xingming");
dianhua=request.getParameter("dianhua");
bumen =request.getParameter("bumen");
%>
<%=bumen%>
<%
if (bumen==null||bumen=="0"){
sql=" SELECT * from dia_file WHERE NAMEPINYIN LIKE '%"+xingming+"%' AND TEL LIKE '%"+dianhua+"%' ";
}else{
sql=" SELECT * from dia_file WHERE DEPARVA='"+bumen+"' ";
}
%>
<%=bumen%>
bumen 等于0
但是还是执行else后的sql
如何写在才能执行前面的sql ,我的写法错在那里
<%! String sql="";
String xingming="";
String dianhua="";
String bumen="";
%>
<%
xingming=request.getParameter("xingming");
dianhua=request.getParameter("dianhua");
bumen =request.getParameter("bumen");
%>
<%=bumen%>
<%
if (bumen==null||bumen=="0"){
sql=" SELECT * from dia_file WHERE NAMEPINYIN LIKE '%"+xingming+"%' AND TEL LIKE '%"+dianhua+"%' ";
}else{
sql=" SELECT * from dia_file WHERE DEPARVA='"+bumen+"' ";
}
%>