帮忙看一下下面的代码
请教.用SQL怎么能实现
我自己做出来了但是不能运行.为什么
<% dim sfzh,xm,flag
sfzh=trim(request.form("sfzh")) //按身份证号或姓名或其它就没有写
xm=trim(request.form("xm"))
s1="select * from ryjbqk where"
if sfzh<>"" then
s1=s1&"sfzh='"&sfzh&"'"
flag=1 //区分条件有没有被选中
end if
if xm<>"" and flag=1 then
s1=s1&"and xm like '%"&xm&"%'"
flag=1
else if xm<>"" then
s1=s1&"xm like '%"&xm&"%'"
flag=1
end if
rs.open s1,conn,1,1
if not rs.eof then%>
<TABLE>
<%do while not rs.eof %>
<TR align=middle>
<% for i=0 to rs.fields.count-1%>
<td ><%=rs(i).value%></td>
<% next%>
</TR>
<% rowcount=rowcount-1
rs.movenext
loop
rs.close
set rs=nothing%>
</TABLE>
<% end if%>