% If Request.QueryString.Count > 0 or Request.Form.Count > 0 Then 'CONSULTA PRODUCTOS MyQuery = " SELECT " & _ " P.IdProducto," & _ " P.Nombre," & _ " P.IdCategoria," & _ " (SELECT MIN(PP.Precio) FROM ProductoPresentacion PP WHERE PP.IdProducto = P.IdProducto) Precio," & _ " P.Path," & _ " P.Ampliado," & _ " (SELECT C.Nombre FROM Categoria C WHERE C.IdCategoria = P.IdCategoria) Categoria, " & _ " (SELECT C.Descripcion FROM Categoria C WHERE C.IdCategoria = P.IdCategoria) Categoria " & _ " FROM" & _ " Producto P" & _ " WHERE" & _ " 1 = 1" 'APLICO FILTROS DE BUSQUEDA If Request.Form("txtBusqueda") <> "" Then MyQuery = MyQuery & " AND (P.Nombre like '%"& Request.Form("txtBusqueda") &"%'" MyQuery = MyQuery & " OR (P.Ampliado like '%"& Request.Form("txtBusqueda") &"%')" MyQuery = MyQuery & " OR P.IdDroga IN (SELECT IdDroga FROM Droga WHERE Nombre like '%"& Request.Form("txtBusqueda") &"%'))" else If Request.QueryString("intCategoria") <> "" Then MyQuery = MyQuery & " AND P.IdCategoria = "& Request.QueryString("intCategoria") &"" End if End if If Request.QueryString("strLetra") <> "" Then MyQuery = MyQuery & " AND (P.Nombre like '"& Request.QueryString("strLetra") &"%' OR P.Ampliado like '"& Request.QueryString("strLetra") &"%')" End if 'DEFINO ORDEN MyQuery = MyQuery & " ORDER BY P.Nombre ASC" Else MyQuery = " SELECT" & _ " PR.IdProducto," & _ " P.Nombre," & _ " P.IdCategoria," & _ " (SELECT MIN(PP.Precio) FROM ProductoPresentacion PP WHERE PP.IdProducto = P.IdProducto) Precio," & _ " P.Path," & _ " P.Ampliado," & _ " (SELECT C.Nombre FROM Categoria C WHERE C.IdCategoria = P.IdCategoria) Categoria " & _ " FROM" & _ " ProductoRanking PR," & _ " Producto P" & _ " WHERE" & _ " P.IdProducto = PR.IdProducto" & _ " ORDER BY" & _ " PR.IdRanking ASC" End if 'Response.Write myquery Ds.Open MyQuery , Db If not Ds.EOF Then RegistrosProductos = Ds.GetRows End if Ds.Close sQuery = "SELECT Cotizacion FROM Cotizacion_Euro" Ds.open sQuery if not Ds.Eof then regCotizacion = ds.getrows end if Ds.close '------------------------------------------------------------------------------------------------------------------------------- Dim strDestinationPathProducto 'As String strDestinationPathProducto = "../../common/Files/Productos/" %>
_
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||