ASP - listar datos

 
Vista:

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
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:listar datos

Publicado por weirdmix (210 intervenciones) el 08/11/2007 16:23:08
es mas facil si cambias el query:

SQL="SELECT ID_Prod, Tipo_Prod, Oferta_Prod, Marca_prod, Precio_prod FROM Tabla where Oferta_Prod<>0 "

saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:listar datos

Publicado por ueibanabreak (5 intervenciones) el 10/11/2007 04:20:21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'trata con esto
dim base
dim re
dim sql
 e = Server.MapPath("bdprueba.mdb")
   set base =  Server.CreateObject("ADODB.Connection")
   set re = server.CreateObject("ADODB.Recordset")
   base.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + e + ";Persist Security Info=False"
 base.Open
SQL="SELECT ID_Prod, Tipo_Prod, Oferta_Prod, Marca_prod, Precio_prod FROM Tabla"
Set re = Conexion.execute(SQL)
if not re.eof  then
  do
   ' aca sacas todos los datos del formulario
    re.movenext
  loop until re.eof
end if
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar