Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/12/2003, 03:26
Teri
 
Fecha de Ingreso: abril-2003
Ubicación: Madrid
Mensajes: 707
Antigüedad: 21 años, 1 mes
Puntos: 0
Probablemente tu pregunta tiene más que ver con ASP, pero no es la cuestión, hay un par de cosas que me parece hay que modificar:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/info_auto.asp" -->
<%
Dim rsR__varMarca
rsR__varMarca = "0"
If (Request.QueryString("marca") <> "") Then
rsR__varMarca = Request.QueryString("marca")
End If
%>
<%
Dim rsR__varAno
rsR__varAno = "0"
If (Request.QueryString("ano") <> "") Then
rsR__varAno = Request.QueryString("ano")
End If
%>
<%
Dim rsR__varPrecio
rsR__varPrecio = "0"
If (Request.QueryString("precio") <> "") Then
rsR__varPrecio = Request.QueryString("precio")
End If
%>
<% Dim h1 as string, h2 as string
h2 = ""
h1 = "SELECT puesto, marca, modelo, categoria, ano, cod_precio, precio FROM automotriz WHERE "
' Pon un espacio detrás del WHERE
%>
<%
' En vez de preguntar por el QueryString, pregunta por la variable rsR__varMarca, que ya la has inicializado antes
If (rsR__varMarca <> "0")Then
h2 = "AND marca LIKE '" + Replace(rsR__varMarca, "'", "''") + "' "
End If
'Pon aquí también el AND, al final de las condiciones quitaremos el primero de ellos
%>
<%
'lo mismo que con marca
If (rsR__varAno <> "0")Then
h2 = h2 + "AND ano LIKE " + Replace(rsR__varAno, "'", "''") + " "
End If %>
' Además pon un espacio al final
' igual que con marca y ano
<% If (rsR__varPrecio <> "0")Then
h2 = h2 + "AND cod_precio LIKE " + Replace(rsR__varPrecio, "'", "''")
End If %>
<%
'Primero de todo... puede que ninguno de los tres tenga valor, hay que quitar la parte del where en h1
' si no quitar el primer AND
If h2 = "" then
h1 = Left(h1,len(h1) - 5
Else
h2 = Mid(h2, 5, len(h2))
End If
%>
<%
Dim rsR
Dim rsR_numRows
Set rsR = Server.CreateObject("ADODB.Recordset")
rsR.ActiveConnection = MM_info_auto_STRING
' poner un espacio antes del ORDER BY
rsR.Source = h1 + " ORDER BY puesto ASC"
'un espacio antes del ORDER BY
rsR.CursorType = 0
rsR.CursorLocation = 2
rsR.LockType = 1
rsR.Open()

rsR_numRows = 0
%>

Con esto debería funcionar..... Suerte