Foros del Web » Programando para Internet » ASP Clásico »

Mostrar Mensaje

Estas en el tema de Mostrar Mensaje en el foro de ASP Clásico en Foros del Web. Hola Amigoss Tengo Un Motor De Busqueda En Mi Pagina, Que Si Encuentra Algo Manda Resultados Y Si No Lo Encuentra Manda Un Mensaje De ...
  #1 (permalink)  
Antiguo 10/08/2005, 13:04
Avatar de kyo1982  
Fecha de Ingreso: mayo-2005
Mensajes: 71
Antigüedad: 19 años
Puntos: 0
Pregunta Mostrar Mensaje

Hola Amigoss

Tengo Un Motor De Busqueda En Mi Pagina, Que Si Encuentra Algo Manda Resultados Y Si No Lo Encuentra Manda Un Mensaje De Que "no Se Encontro Nada".

Bueno Mi Problema Radica En Que Cuando Acceso Al Motor Por Defecto Me Sale "no Se Encontro Nada"., Cosa Que Esta Raro, Ya Que Deberia Salir Despues De Ejecutar La Busqueda Y No Cuando La Pagina Cargue La Pagina.

Espero Me Ayuden Amigos
__________________
Gracias TOTALES :-D
  #2 (permalink)  
Antiguo 10/08/2005, 13:08
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
donde estaás chekeando el .bof=false and .eof=false le pones esto:

if variable_q_busca <> "" then
if RS.bof=false and RS.eof=false then
Response.write("Encontro algo")
else
Response.write("no encontro nada")
end if
end if

saludos
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
  #3 (permalink)  
Antiguo 10/08/2005, 13:11
Avatar de u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 22 años, 5 meses
Puntos: 98
Bueno, pues jugando al adivino, el error que tienes es de logica, y lo debes resolver mediante una condicion.

Código:
variable_busqueda = request.[form][querystring]("buscar")
Si len(variable_busqueda) > 0 then
  'ejecuta busqueda
Else
  'No ejecutes busqueda
Fin Si
Salu2,
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway
  #4 (permalink)  
Antiguo 10/08/2005, 14:18
Avatar de kyo1982  
Fecha de Ingreso: mayo-2005
Mensajes: 71
Antigüedad: 19 años
Puntos: 0
amigos he hecho lo que me han mandado y no me funcione, me sale lo mismo, voy a poner el codigo aqui, para ver si me ayudan a echarle un ojo, espero me ayuden .

******************************************
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/galope.asp" -->
<%
Dim r__busqueda
r__busqueda = "''"
If (request.querystring("Numero_de_Cuenta") <> "") Then
r__busqueda = request.querystring("Numero_de_Cuenta")
End If %>
<%
Dim r__fecha1
r__fecha1 = "1/1/2005"
If (request.querystring("Fecha_Inicial") <> "") Then
r__fecha1 = request.querystring("Fecha_Inicial")
End If %>
<%
Dim r__fecha2
r__fecha2 = "1/1/2005"
If (request.querystring("Fecha_Final") <> "") Then
r__fecha2 = request.querystring("Fecha_Final")
End If %>
<%
Dim r__USER
r__USER = "%"
If (SESSION("MM_USERNAME") <> "") Then
r__USER = SESSION("MM_USERNAME")
End If %>
<%
Dim r
Dim r_numRows
Set r = Server.CreateObject("ADODB.Recordset")
r.ActiveConnection = MM_galope_STRING
r.Source = "SELECT a.cod_cuenta,fecha5=datename(mm,a.fecha)+' '+convert(char(2),datepart(d,a.fecha))+','+ convert(char(4),datepart(yy,a.fecha)),hora=rtrim(c onvert(char(2),datepart(hh,hora)))+':'+ convert(char(2),datepart(mi,hora))+':'+convert(cha r(2),datepart(ss,hora)), a.fecha, b.NOM_mensajero, a.cod_cliente, a.distribucion, a.anotacion, a.latitud,a.longitud FROM tab_pda_eb_maestro a, tab_mensajero b WHERE a.cod_mensajero = b.cod_mensajero and a.cod_cuenta = '" + Replace(r__busqueda, "'", "''") + "' and a.fecha >= '" + Replace(r__fecha1, "'", "''") + "' and a.fecha<='" + Replace(r__fecha2, "'", "''") + "' and a.cod_cliente in (select cod_cliente FROM empresas WHERE usuario='" + Replace(r__USER, "'", "''") + "') ORDER BY a.fecha DESC"
r.CursorType = 0
r.CursorLocation = 2
r.LockType = 1
r.Open()
r_numRows = 0 %>
<% Dim RE
Dim RE_numRows
Set RE = Server.CreateObject("ADODB.Recordset")
RE.ActiveConnection = MM_galope_STRING
RE.Source = "SELECT * FROM dbo.empresas "
RE.CursorType = 0
RE.CursorLocation = 2
RE.LockType = 1
RE.Open()
RE_numRows = 0%>
<% Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = 15
Repeat2__index = 0
r_numRows = r_numRows + Repeat2__numRows
%>
<% Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
r_numRows = r_numRows + Repeat1__numRows %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>GALOPE -- Entrega a Tiempo</title>
<!-- <script language="JavaScript" src="js/date-picker.js"></script> !-->
<script language="JavaScript" src="date-picker.js">
</script>
<style type="text/css">
<!--
.Estilo11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
.Estilo29 {font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; }
.Estilo36 {color: #FFFFFF}
.Estilo46 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
font-weight: bold;
}
.Estilo47 {font-family: Verdana, Arial, Helvetica, sans-serif}
body {
background-color: #CCCCCC;
}
.Estilo56 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 16px;
color: #FFFFFF;
}
.Estilo57 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFFF00;
}
.Estilo59 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
.Estilo60 {font-size: 12px; font-weight: bold; }
.Estilo62 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; }
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function validar() {
inicio=document.getElementById('Fecha_Inicial').va lue;
final=document.getElementById('Fecha_Final').value ;
inicio=new Date(inicio);
final=new Date(final);
if(inicio>final)
alert('Por Favor, verifique las Fechas');
}
//-->
</script>
</head>
<body>
<table width="725" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th bgcolor="#000033" scope="row"><div align="center">
</div></th>
</tr>
<tr>
<td width="557" valign="top"><table width="569" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000033">
<tr>
<th rowspan="5" valign="top" bgcolor="#000033" scope="row"> <table width="100%" border="0" cellpadding="0">
<tr>
<td><table width="92%" border="0" cellpadding="0" cellspacing="0">
<tr>
<th scope="col">&nbsp;</th>
</tr> <tr>
<th scope="col">&nbsp;</th>
</tr> <tr>
<td>&nbsp;</td>
</tr> <tr>
<td>&nbsp;</td>
</tr> <tr>
<td>&nbsp;</td>
</tr> <tr>
<td>&nbsp;</td>
</tr> </table></td>
</tr> <tr>
<td>&nbsp;</td>
</tr> </table> </th>
<th bgcolor="#000033" scope="row">&nbsp;</th>
</tr> <tr>
<th bgcolor="#CCCCCC" scope="row">&nbsp;</th>
</tr> <tr>
<th bgcolor="#000033" scope="row">&nbsp;</th>
</tr> <tr>
<th align="left" valign="middle" bgcolor="#CCCCCC" scope="row"><form action="galope22.asp" method="get" name="form1" id="form1">
<table width="647" border="1" align="center" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<tr>
<th width="128" height="36" scope="row"><div align="right"><span class="Estilo11">N&uacute;mero de Cuenta </span></div></th>
<td><input name="Numero_de_Cuenta" type="text" id="Numero_de_Cuenta" style="width:100 px;" value="<%= Request.QueryString("Numero_de_Cuenta") %>"></td>
<td width="54">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th scope="row"><div align="right"><span class="Estilo11">Fecha Inicial </span></div></th>
<td width="144"><input name="Fecha_Inicial" type="text" readonly="" id="Fecha_Inicial" value="<%= Request.QueryString("Fecha_Inicial") %>" maxlength="0"></td>
<td><div align="left"><a href="javascript:show_calendar('form1.Fecha_Inicia l')"><img src="images/calbtn.gif" width="34" height="22" border="0" alt="Seleccione una Fecha"></a></div></td>
<td width="84"><div align="right"><span class="Estilo59">Fecha Final</span></div>
<td width="144"><div align="left">
<input name="Fecha_Final" type="text" readonly="" id="Fecha_Final" value="<%= Request.QueryString("Fecha_Final") %>" maxlength="0">
</div>
<td width="37"><div align="left"><a href="javascript:show_calendar('form1.Fecha_Final' )"><img src="images/calbtn.gif" width="34" height="22" border="0" alt="Seleccione una Fecha"></a></div></td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>

<td><input name="Enviar" type="submit" value="Buscar"></td>
<td>&nbsp;</td>
<td>&nbsp; </td>
<td>&nbsp;</td>
</tr>
</table>
</form></th>
</tr>
<tr>
<td height="116" valign="top" scope="row"> <% If Not r.EOF Or Not r.BOF then %>
<table width="520" border="1" align="center" bordercolor="#FFFFFF">
<tr bgcolor="#DC2B19">
<th colspan="5" bgcolor="#000033" scope="row"><span class="Estilo29">Resultados de la B&uacute;squeda</span></th>
</tr>
<tr>
<th colspan="5" scope="row"><table width="100%" height="100%" border="1" align="center">
<tr bgcolor="#DC2B19">
<td bgcolor="#000033"><div align="center" class="Estilo60"><span class="Estilo29">Cuenta</span></div></td>
<td bgcolor="#000033"><div align="center" class="Estilo60"><span class="Estilo47"><span class="Estilo36">Fecha</span></span></div></td>
<td bgcolor="#000033"><div align="center" class="Estilo60"><span class="Estilo29">Hora</span></div></td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT r.EOF)) %>
<tr>
<td nowrap><div align="center"><span class="Estilo59"><%=(r.Fields.Item("cod_cuenta").V alue)%></span></div></td>
<td nowrap><div align="center"><span class="Estilo59"><%=(r.Fields.Item("fecha5").Value )%></span></div></td>
<td nowrap><div align="center"><span class="Estilo59"><%=(r.Fields.Item("hora").Value)% ></span></div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
r.MoveNext()
Wend
%>
</table>
<p>&nbsp; </p></th>
</tr>
</table>
<%
else
Response.Write "<b><font color='#000000'></font></b>"
End If
' end Not r.EOF Or NOT r.BOF %>
<% If r.EOF And r.BOF Then %>
<p>no se encontro nada </p>
<% End If ' end r.EOF And r.BOF %></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#DC2B19">
<th valign="top" bgcolor="#000033" scope="row">&nbsp;</th>
</tr>
</table>
</body>
</html>
<%
r.Close()
Set r = Nothing
%>
<%
RE.Close()
Set RE = Nothing
%>

******************************************
__________________
Gracias TOTALES :-D
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:33.