Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/05/2002, 04:42
danipermuy
 
Fecha de Ingreso: abril-2002
Mensajes: 216
Antigüedad: 23 años
Puntos: 0
codigo para busar error

pagina que envia el formulario:
Código:
<form method="POST" action=consultascomercial_b.asp>
 
  <p align="left"><b><br>
    Consultar visitas de comerciales</b></p>

  <p align="left">   Nombre comercial:
  <select size="1" name="comercial">
  <%do while not miconexion.eof %>
  <option value=<% Response.write(miconexion.fields("dni") & " <br>")%><% response.write(miconexion.fields("nombre") & " <br>")%></option>
    <% miconexion.movenext
  loop%>
    <option selected value="*">Todos los comerciales</option>
  </select>

  <p align="left">  Visita realizada entre el día:<input type="text" name="fechaini" size="9">  <br>
    y el: <input type="text" name="fechafin" size="9">
  (ej.20/01/1981)<br>
    </p>
  <p align="center"><input type="submit" value="Enviar" name="B1"><input type="reset" value="borrar" name="B2"><br>
    </p>
  </form>
Pagina que lo recibe(aki esta el error)
Código:
 if comercial='*' and fechaini="" and fechafin="" then
strsql = "select * from visitas " 
	else if comercial='*' and fechaini<>"" and fechafin<>"" then
	strsql = "select * from visitas where fecha>="&fechaini& "and" &fecha<=fechafin
		else
		if fechaini="" and fechaini="" then
  		strsql="select * from visitas where dni=" &comercial
  			else
  			strsql="select * from visitas where dni= " &comercial& "and fecha >= " & fechaini & " and fecha <= "&
las variables comercial,fechaini y fechafin estan bien definidas. Podeis ayudar, el error está en los if creo.
Gracias