listar datos
Publicado por javier (1 intervención) el 08/11/2007 04:49:41
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<table width="200" border="0" align="center" name="logo" noresize>
<tr>
<td>
<p align="center">
<img src="imagenes/LOGO.GIF"/>
</p>
</td>
</tr>
</table>
<p> </p>
<p>Buscador de Productos</p>
<%dim marca, precio, tipo, oferta, producto
marca = request.form("marca")
precio = cint(request.form("precio"))
tipo = request.form("tipo")
oferta = cint(request.form("oferta"))
variable_lista = request.querystring("lista")
variable_producto = request.querystring("producto")
response.write "el valor de lista es: " & variable_lista
response.write "<br />"
response.write "el valor de producto es: " & variable_producto
Dim Conexion, SQL
Set Conexion = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conexion.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("basededatos/bdprueba.mbd.mdb")
SQL="SELECT ID_Prod, Tipo_Prod, Oferta_Prod, Marca_prod, Precio_prod FROM Tabla"
Set Rs = Conexion.execute(SQL)
%>
<table width="400" border="1">
<tr>
<td>ID Producto</td>
<td>Tipo Producto</td>
<td>Oferta Producto</td>
<td>Marca producto</td>
<td>Precio producto</td>
</tr>
<%
if(variable_lista = 1 and variable_producto = 1) then
do while not Rs.eof
if(Oferta_Prod = 0) then
%>
<tr>
<td><% = Rs(0) %></td>
<td><% = Rs(1) %></td>
<td><% = Rs(2) %></td>
<td><% = Rs(3) %></td>
<td><% = Rs(4) %></td>
</tr>
<%
Rs.movenext
end if
loop
else
response.write "No existen registros asociados"
end if
%>
</table>
<h3 align="center">
<%
Conexion.execute(SQL)
Conexion.Close
Set Conexion = nothing
%>
<br />
<br />
<br />
<a href="default.asp">Volver </a></h3>
</body>
</html>
bueno ahora la duda
en el codigo que muestro necesito listar solo algunos valores por ejemplo si Oferta_Prod = 0
pero resulta que me esta listando todos los valores
no se como lo puedo hacer
si me pueden ayudar mucha gracias
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<table width="200" border="0" align="center" name="logo" noresize>
<tr>
<td>
<p align="center">
<img src="imagenes/LOGO.GIF"/>
</p>
</td>
</tr>
</table>
<p> </p>
<p>Buscador de Productos</p>
<%dim marca, precio, tipo, oferta, producto
marca = request.form("marca")
precio = cint(request.form("precio"))
tipo = request.form("tipo")
oferta = cint(request.form("oferta"))
variable_lista = request.querystring("lista")
variable_producto = request.querystring("producto")
response.write "el valor de lista es: " & variable_lista
response.write "<br />"
response.write "el valor de producto es: " & variable_producto
Dim Conexion, SQL
Set Conexion = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
Conexion.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("basededatos/bdprueba.mbd.mdb")
SQL="SELECT ID_Prod, Tipo_Prod, Oferta_Prod, Marca_prod, Precio_prod FROM Tabla"
Set Rs = Conexion.execute(SQL)
%>
<table width="400" border="1">
<tr>
<td>ID Producto</td>
<td>Tipo Producto</td>
<td>Oferta Producto</td>
<td>Marca producto</td>
<td>Precio producto</td>
</tr>
<%
if(variable_lista = 1 and variable_producto = 1) then
do while not Rs.eof
if(Oferta_Prod = 0) then
%>
<tr>
<td><% = Rs(0) %></td>
<td><% = Rs(1) %></td>
<td><% = Rs(2) %></td>
<td><% = Rs(3) %></td>
<td><% = Rs(4) %></td>
</tr>
<%
Rs.movenext
end if
loop
else
response.write "No existen registros asociados"
end if
%>
</table>
<h3 align="center">
<%
Conexion.execute(SQL)
Conexion.Close
Set Conexion = nothing
%>
<br />
<br />
<br />
<a href="default.asp">Volver </a></h3>
</body>
</html>
bueno ahora la duda
en el codigo que muestro necesito listar solo algunos valores por ejemplo si Oferta_Prod = 0
pero resulta que me esta listando todos los valores
no se como lo puedo hacer
si me pueden ayudar mucha gracias
Valora esta pregunta


0