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

Busqueda Multiple en .asp

Estas en el tema de Busqueda Multiple en .asp en el foro de ASP Clásico en Foros del Web. Buenas tardes, necesito su ayuda!!! Tengo una pagina web interna de mi trabajo y necesito adjuntar una parte la cual haga una busqueda multiple. Es ...

  #1 (permalink)  
Antiguo 25/09/2010, 12:20
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Pregunta Busqueda Multiple en .asp

Buenas tardes, necesito su ayuda!!! Tengo una pagina web interna de mi trabajo y necesito adjuntar una parte la cual haga una busqueda multiple. Es decir, tengo 5 campos de resultado: N# de solicitud, Nombre de empleado, Descripcion de cambio, Estado (Pendinte, cerrado, Abierto). Qusiiera la busqueda se pueda realizar de tal manera de los resultados ya ingresados por ej. pueda buscar: 1) De "X" empleado, buscar aquellos cambios "Pendientes" de tal numero de solicitud. Se puede hacer eso? Muchas gracias!
  #2 (permalink)  
Antiguo 25/09/2010, 13:16
Avatar de Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 4 meses
Puntos: 126
Respuesta: Busqueda Multiple en .asp

Hola

Una ración de SQL marchando

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />
  #3 (permalink)  
Antiguo 30/09/2010, 08:03
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

Hola disculpa que me meta, si se puede realizar busqueda multiples, si todavia no solucionar el tema, avisame, creo que te puedo ayudar.
  #4 (permalink)  
Antiguo 01/10/2010, 07:41
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

Junnior, muchas gracias! La verdad aun no se como hacerlo. La verdad es que no me quedo muy claro como poder hacer lo que necesito. Aqui dejo mi script:

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")

if ( poo = "" and sta = "") then
Sql= "SELECT * FROM Plans"
else
if(sta="") then
Sql= "SELECT * FROM Plans WHERE Pool LIKE '%" & poo & "%'"
else
Sql= "SELECT * FROM Plans WHERE Status LIKE '%" & sta & "%'"
end if
end if
dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, OBJdbConnection, 3, 3 %>

<CENTER>

<TABLE BORDER=1>
<TR>
<tr bgcolor= "#990000">
<TH><font color="#FFFFFF">Clave</font></TH>
<TH><font color="#FFFFFF">Manager Approval</font></TH>
<TH><font color="#FFFFFF">Category</font></TH>
<TH><font color="#FFFFFF">Priority</font></TH>
<TH><font color="#FFFFFF">Description</font></TH>
<TH><font color="#FFFFFF">Pool</font></TH>
<TH><font color="#FFFFFF">OwnerTrainer</font></TH>
<TH><font color="#FFFFFF">AssociateTrainee</font></TH>
<TH><font color="#FFFFFF">DueDate</font></TH>
<TH><font color="#FFFFFF">StartDate</font></TH>
<TH><font color="#FFFFFF">DateCompleted</font></TH>
<TH><font color="#FFFFFF">AdditionalComments</font></TH>
<TH><font color="#FFFFFF">Status</font></TH>

<% DO UNTIL rs.Eof %>
<TR>

<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Clave") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("ManagerApproval") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Category") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Priority") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Description") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Pool") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("OwnerTrainer") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("AssociateTrainee") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("DueDate") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("StartDate") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("DateCompleted") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("AdditionalComments") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Status") %> </CENTER></b></TD>

<% rs.MoveNext
LOOP
set rs = Nothing
OBJdbConnection.Close
set OBJdbConnection = Nothing%>


</TABLE>


La idea es que asi como lo tengo solo busca o por Pool o por Status. Necesito que si elijo X pool e Y Status busque en ambas, y no por separado.

GRacias!!!!
  #5 (permalink)  
Antiguo 01/10/2010, 08:01
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

que ete parece si lo hacemos por separado y si se cumple la condicion se ve la info.

Supongo que validate que si es vacio ambos text, traera toda la info, correcto.


este sera el primer select

Sql = "select * from planes"
'aramo cadena para saber si espero un paremtro
if(sta<>"") then
Sql2 = sql2 & "WHERE Status LIKE '%" & sta & "%' "
end if
if(Pool <>"") then
Sql2 = sql2 & "WHERE Pool LIKE '%" & poo & "%'"
end if

Sql = Sql & Sql2

puedes ocupara la qe mejor te acomode
set rs = oConn.Execute(Sql)

rs.Open sql, OBJdbConnection, 3, 3

espero que te funciona, esta es la logica.
has la pueba, veras tus distintos resultados.
si aún no te queda claro avisame.
  #6 (permalink)  
Antiguo 01/10/2010, 08:40
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

Gracias Junnior por tu pronta respuesta. Este es el script como esta ahora:

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")

Sql = "select * from Plans"
'aramo cadena para saber si espero un paremtro
if(sta <>"") then
Sql2 = sql2 & "WHERE Status LIKE '%" & sta & "%' "
end if
if(Pool <>"") then
Sql2 = sql2 & "WHERE Pool LIKE '%" & poo & "%'"
end if

Sql = " Sql & Sql2 "

end if
dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, OBJdbConnection, 3, 3 %>

Me dice lo siguiente:

Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/PlanManagementTool/search.asp, line 44


La linea 44 es donde arranca el ultimo end if.
  #7 (permalink)  
Antiguo 01/10/2010, 09:31
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

esto se produce cuando realizas la busqueda uno por uno, o llenas los 2 campos y buscas?

si es asi como imagino.

tienes que hacer otra cadena (otro if) preguntando por ambos

If(campo1<>'' and campo2 <>'' then
Sql2 = sql2 & "WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

prueba y me avisas.
  #8 (permalink)  
Antiguo 01/10/2010, 09:33
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

ese ultimo if que me dices borralo porque no corresponde.
  #9 (permalink)  
Antiguo 01/10/2010, 09:39
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

La busqueda que necesito realizar es por dos campos a la vez o cuando presiono el boton busqueda por todos losa campos sin seleccion.

Asi es como quedo es script:

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")

If(field1 <>'' and field2 <>'' then
Sql2 = sql2 & "WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "


dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, OBJdbConnection, 3, 3 %>

Me da un error de syntax en la linea 33 Col 12 que seria (If(field1 <>'' and field2 <>'' then
)

Gracias!

Pd. En caso se te ocurra otra forma de hacerlo que no sea con mi modelo de busqueda bienvenido sea!! jejeje
  #10 (permalink)  
Antiguo 01/10/2010, 09:46
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

consulta: recien estas trabajando con asp?


<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")

If(poo <>'' and sta <>'' then
Sql2 = sql2 & "WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if


dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open Sql2 , OBJdbConnection, 3, 3 %>

Me da un error de syntax en la linea 33 Col 12 que seria (If(field1 <>'' and field2 <>'' then
)

claro le falto el end if


manadame todo el codigo de la busqueda, incluye todo. y te pego la revisada.
  #11 (permalink)  
Antiguo 01/10/2010, 10:01
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

No, vengo trabajando desde hace unos meses, pero no le busco la vuelta para las busquedas...

Hasta aora solo podia hacer busqueda de a un campo no de a varios.

<HTML>
<TITLE> Search Plan Status information </TITLE>
<body bgcolor="#FFFFFF" bgproperties="fixed" background="ibmbackgroundsuave.jpg">
<p style="margin-top: 0; margin-bottom: 0">
<img SRC="ServiceManagement.bmp" width="600" height="95"> </p>
&nbsp; </p>
<table width="100%" align=left>
<td width="50%" align=right>
<table align="left">
<td align="left">
<p style="margin-top: 0; margin-bottom: 0">&nbsp;
<a href="http://www.forosdelweb.com/f15/PlanManagementTool/Default.htm"><font color="#000000">Home</font></a>
<font color="#000000"> | </font>
<a target="_top" href="search.htm"><font color="#000000">Plan Status Search</font></a>
<font color="#000000"> | </font>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p style="margin-top: 0; margin-bottom: 0">
</p>
<br>
</p>
<hr>

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")

If(poo <>"" and sta <>"") then
Sql2 = sql2 & "WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open Sql2 , OBJdbConnection, 3, 3 %>

<CENTER>

<TABLE BORDER=1>
<TR>
<tr bgcolor= "#990000">
<TH><font color="#FFFFFF">Clave</font></TH>
<TH><font color="#FFFFFF">Manager Approval</font></TH>
<TH><font color="#FFFFFF">Category</font></TH>
<TH><font color="#FFFFFF">Priority</font></TH>
<TH><font color="#FFFFFF">Description</font></TH>
<TH><font color="#FFFFFF">Pool</font></TH>
<TH><font color="#FFFFFF">OwnerTrainer</font></TH>
<TH><font color="#FFFFFF">AssociateTrainee</font></TH>
<TH><font color="#FFFFFF">DueDate</font></TH>
<TH><font color="#FFFFFF">StartDate</font></TH>
<TH><font color="#FFFFFF">DateCompleted</font></TH>
<TH><font color="#FFFFFF">AdditionalComments</font></TH>
<TH><font color="#FFFFFF">Status</font></TH>

<% DO UNTIL rs.Eof %>
<TR>

<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Clave") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("ManagerApproval") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Category") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Priority") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Description") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Pool") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("OwnerTrainer") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("AssociateTrainee") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("DueDate") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("StartDate") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("DateCompleted") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("AdditionalComments") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Status") %> </CENTER></b></TD>

<% rs.MoveNext
LOOP
set rs = Nothing
OBJdbConnection.Close
set OBJdbConnection = Nothing%>


</TABLE>

&nbsp;
<table width="84%" align="left">
<tr>
<td width="50%" align="right">
<table align="left">
<tr>
<td align="center">
</FORM>
<table width="100%" align="left">
<td width="50%" align="right">
<table align="left">
<td align="left">

</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</BODY>
</HTML>

Este es todo el script
  #12 (permalink)  
Antiguo 01/10/2010, 10:13
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

estas seguro que esta todo, revise y falta los text (input text)
donde se ingresa la palabra a buscar, igual te voy a dar un ejempo
  #13 (permalink)  
Antiguo 01/10/2010, 10:16
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

ahhhhhhhh, perdon!

ahi va:

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 5.0">
<TITLE>Plan Status Seach</TITLE>
</HEAD>
<body bgcolor="#FFFFFF" bgproperties="fixed" background="ibmbackgroundsuave.jpg">
<p style="margin-top: 0; margin-bottom: 0">
<img SRC="ServiceManagement.bmp" width="600" height="95">
&nbsp;
<table width="84%" align="left">
<td width="50%" align="right">
<table align="left">
<td align="center">
<p style="margin-top: 0; margin-bottom: 0">&nbsp;
<a href="http://www.forosdelweb.com/f15/PlanManagementTool/Default.htm"><font color="#000000">Home</font></a>
<font color="#000000"> | </font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p style="margin-top: 0; margin-bottom: 0">
<a href="http://www.forosdelweb.com/f15/PlanManagementTool/Default.htm"><font color="#000000"><br>
<br>
<p style='margin:0cm;margin-bottom:.0001pt;line-height:150%'><marquee behavior="Alternate" scrolldelay="50" scrollamount="4"
style="font-size: 20pt; color: #990000; font-weight: bold">Plan Status Search</marquee></p>
</font></a> <br>
<hr>
<FORM action="../PlanManagementTool/search.asp" method=post name="SEA">
<P><font color="#990000" size="4"><b><u>Section search by data</u></b></font>&nbsp;</P> <P><font color="#000000"><u><b>Search by Pool:</b></U></font>&nbsp;<br><P> <IMG SRC="pool.bmp" border="2">

<br>
<INPUT NAME="texto" size="25" tabindex="0"><br>
<br>
<U><b><font color="#000000"><font size="4">or<br>
</font>
<br>
Search by Status&nbsp;:</font></b></U><br><P> <IMG SRC="status.bmp" border="2">

<br>
<INPUT NAME="nombre" size="25" tabindex="1"></P>
<P>
<INPUT type=submit value=Search tabindex="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;
<INPUT type=reset value=Restore tabindex="3"><br>
<br>
<font color="#000000"><b><u>Note :</u></b></font> If you leave blank &quot;Search of data&quot; field, and you press &quot;Search&quot; you will receive the whole information of the projects.</P>
</FORM>
<table width="84%" align="left">
<td width="50%" align="right">
<table align="left">
<td align="center">
<p style="margin-top: 0; margin-bottom: 0">&nbsp;
<a href="http://www.forosdelweb.com/f15/PlanManagementTool/Default.htm"><font color="#000000">Home</font></a>
</td>
</tr>
</table>
</td>
</tr>
<p>
</BODY>
</HTML>
  #14 (permalink)  
Antiguo 01/10/2010, 10:29
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

ok, prueba,

<HTML>
<TITLE> Search Plan Status information </TITLE>
<body bgcolor="#FFFFFF" bgproperties="fixed" background="ibmbackgroundsuave.jpg">
<p style="margin-top: 0; margin-bottom: 0">
<img SRC="ServiceManagement.bmp" width="600" height="95"> </p>
&nbsp; </p>
<table width="100%" align=left>
<td width="50%" align=right>
<table align="left">
<td align="left">
<p style="margin-top: 0; margin-bottom: 0">&nbsp;
<a href="http://www.forosdelweb.com/f15/PlanManagementTool/Default.htm"><font color="#000000">Home</font></a>
<font color="#000000"> | </font>
<a target="_top" href="search.htm"><font color="#000000">Plan Status Search</font></a>
<font color="#000000"> | </font>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p style="margin-top: 0; margin-bottom: 0">
</p>
<br>
</p>
<hr>

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")
'opcional
set rs = Server.CreateObject("ADODB.Recordset")

sql = " select * from tabla "

If(poo <>"") then
Sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' "
end if

If(sta <>"") then
Sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' "
end if

If(poo <>"" and sta <>"") then
Sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

'concateno variables
sql = sql & sql2

'espero que tu coneccion sea buena.
dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open Sql , OBJdbConnection, 3, 3 %>

<CENTER>


<TABLE BORDER=1>
<TR>
<tr bgcolor= "#990000">
<TH><font color="#FFFFFF">Clave</font></TH>
<TH><font color="#FFFFFF">Manager Approval</font></TH>
<TH><font color="#FFFFFF">Category</font></TH>
<TH><font color="#FFFFFF">Priority</font></TH>
<TH><font color="#FFFFFF">Description</font></TH>
<TH><font color="#FFFFFF">Pool</font></TH>
<TH><font color="#FFFFFF">OwnerTrainer</font></TH>
<TH><font color="#FFFFFF">AssociateTrainee</font></TH>
<TH><font color="#FFFFFF">DueDate</font></TH>
<TH><font color="#FFFFFF">StartDate</font></TH>
<TH><font color="#FFFFFF">DateCompleted</font></TH>
<TH><font color="#FFFFFF">AdditionalComments</font></TH>
<TH><font color="#FFFFFF">Status</font></TH>

<% DO UNTIL rs.Eof %>
<TR>

<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Clave") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("ManagerApproval") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Category") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Priority") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Description") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Pool") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("OwnerTrainer") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("AssociateTrainee") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("DueDate") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("StartDate") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("DateCompleted") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("AdditionalComments") %> </CENTER></b></TD>
<TD><b><CENTER><font face="Verdana" size="2"> <%= rs("Status") %> </CENTER></b></TD>

<% rs.MoveNext
LOOP
set rs = Nothing
OBJdbConnection.Close
set OBJdbConnection = Nothing%>


</TABLE>

&nbsp;
<table width="84%" align="left">
<tr>
<td width="50%" align="right">
<table align="left">
<tr>
<td align="center">

<table width="100%" align="left">
<td width="50%" align="right">
<table align="left">
<td align="left">

</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</BODY>
</HTML>
  #15 (permalink)  
Antiguo 01/10/2010, 10:39
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

Me busca solo de un solo campo, si le doy para que busque de a dos me da el siguiente error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Pool LIKE '%DBO%' WHERE Status LIKE '%Solution%' WHERE Status LIKE '%Solution%' and Pool LIKE '%DBO%''.
/PlanManagementTool/search.asp, line 57

LA linea 57 es la siguiente:

rs.Open Sql, OBJdbConnection, 3, 3 %>
  #16 (permalink)  
Antiguo 01/10/2010, 10:48
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

y si cambia tu apertura por este

rs.Open Sql, OBJdbConnection, 1, 1

si no te funciona

response.write sql
response.end

y me enviar al query.
  #17 (permalink)  
Antiguo 01/10/2010, 11:00
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")
'opcional
set rs = Server.CreateObject("ADODB.Recordset")

sql = " select * from Plans "

If(poo <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' "
end if

If(sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' "
end if

If(poo <>"" and sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

'concateno variables
sql = sql & sql2

'espero que tu coneccion sea buena.
dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open Sql, OBJdbConnection, 1, 1%>

Ahora busca de a 1 campo o campos en blancos para traer todo.
Error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC driver does not support the requested properties.
/PlanManagementTool/search.asp, line 57
  #18 (permalink)  
Antiguo 01/10/2010, 11:04
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

si t fijas tienes 2 veces dclarado el record set borra uno
  #19 (permalink)  
Antiguo 01/10/2010, 11:05
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

'espero que tu coneccion sea buena.
dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
rs.Open Sql2, OBJdbConnection, 1, 1%>

Sigue el mismo error, asi lo deje
  #20 (permalink)  
Antiguo 01/10/2010, 11:31
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

escribe lo siguient

response.write sql
response.end

rs.Open Sql2, OBJdbConnection, 3, 3


necesito ver que te imprime en el sql
  #21 (permalink)  
Antiguo 01/10/2010, 11:32
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

es rs.open sql no sql2
  #22 (permalink)  
Antiguo 01/10/2010, 11:36
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

Me abre la pantalla de busqueda y me aparece solo esto:

Realice una busqueda solo del primer campo:
--------------------------------------------------------------------------------
select * from Plans WHERE Pool LIKE '%PSO%'
--------------------------------------------------------------------------------
  #23 (permalink)  
Antiguo 01/10/2010, 11:36
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

sql = " select * from Plans "

If(poo <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' "
end if

If(sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' "
end if

If(poo <>"" and sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

'concateno variables
sql = sql & sql2

'espero que tu coneccion sea buena.
dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
response.write sql
response.end
rs.Open Sql, OBJdbConnection, 1, 1%>
  #24 (permalink)  
Antiguo 01/10/2010, 11:42
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

perfecto te deberia de funcionar

omite
'response.write sql
'response.end

y has denuevo la misma prueba...
  #25 (permalink)  
Antiguo 01/10/2010, 11:47
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

nop, no funciona, mismo error:

Ahora busca de a 1 campo o campos en blancos para traer todo.
Error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC driver does not support the requested properties.
/PlanManagementTool/search.asp, line 57

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")
'opcional
set rs = Server.CreateObject("ADODB.Recordset")

sql = " SELECT fields from Plans "

If(poo <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' "
end if

If(sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' "
end if

If(poo <>"" AND sta <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' AND Status LIKE '%" & sta & "%' "
end if

sql = sql & sql2

dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
rs.Open Sql, OBJdbConnection, 1, 1%>


No habra algun problema en la sequencia :

If(poo <>"" AND sta <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' AND Status LIKE '%" & sta & "%' "
end if ?

Gracias!
  #26 (permalink)  
Antiguo 01/10/2010, 11:51
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

prueba con los 2 campos llenos y le das buscar

response.write sql
response.end

para saber si se cae en donde me mencionas
  #27 (permalink)  
Antiguo 01/10/2010, 11:53
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

Me sale este cartel en la pantalla, no como error, solo esto:


select * from Plans WHERE Pool LIKE '%PSO%' WHERE Status LIKE '%ON GOING%' WHERE Status LIKE '%ON GOING%' and Pool LIKE '%PSO%'

No me trae la table con la informacion.

Lo deje asi:

<%
poo = Request.Form ("texto")
sta = Request.Form ("nombre")
'opcional
set rs = Server.CreateObject("ADODB.Recordset")

sql = " select * from Plans "

If(poo <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' "
end if

If(sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' "
end if

If(poo <>"" and sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

'concateno variables
sql = sql & sql2

dbfile=Server.MapPath("fpdb/ticketsgenerales.mdb")
Set OBJdbConnection=Server.CreateObject("ADODB.Connect ion")
OBJdbConnection.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&dbfile
response.write sql
response.end
rs.Open Sql, OBJdbConnection, 1, 1%>
  #28 (permalink)  
Antiguo 01/10/2010, 11:59
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

esta bien con esto podemos revisar los errores ...y es ovbio que tenemos uno granade y es en la sentencia

select * from Plans WHERE Pool LIKE '%PSO%' WHERE Status LIKE '%ON GOING%' WHERE Status LIKE '%ON GOING%' and Pool LIKE '%PSO%'

si te fijas esta mal


cambia la estructura.

sql = " select * from Plans "

If(poo <>"" and sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' and Pool LIKE '%" & poo & "%' "
end if

If(poo <>"") then
sql2 = sql2 & " WHERE Pool LIKE '%" & poo & "%' "
end if

If(sta <>"") then
sql2 = sql2 & " WHERE Status LIKE '%" & sta & "%' "
end if
  #29 (permalink)  
Antiguo 01/10/2010, 12:03
 
Fecha de Ingreso: julio-2010
Mensajes: 35
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

sigue igual
  #30 (permalink)  
Antiguo 01/10/2010, 12:04
 
Fecha de Ingreso: julio-2007
Mensajes: 58
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: Busqueda Multiple en .asp

te sigue mostrando esto:

select * from Plans WHERE Pool LIKE '%PSO%' WHERE Status LIKE '%ON GOING%' WHERE Status LIKE '%ON GOING%' and Pool LIKE '%PSO%'

Etiquetas: asp, busquedas
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 13:28.