Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/04/2008, 14:47
nancy80
 
Fecha de Ingreso: abril-2008
Mensajes: 1
Antigüedad: 17 años
Puntos: 0
Borrar una Consulta con ASP y JSCRIP

Hola
Estoy comenzando a programar una pagina en ASP y JSCRIPT
ya tengo mi consulta y funciona bien es generada de una base en access tiene 3 tablas relacionadas entre si (Maestro, Detalle prod, Detalle Resp) es una relacion 1 a 1 pero quiero borrar los datos que salgan de esta consulta mediante un boton. Alguien me puede ayudar o tal vez complementar mi problema.

Saludos y Gracias


<%@ LANGUAGE=JScript%>
<%

user=Request.Cookies("nombreusuario");
claveuser=Request.Cookies("username");
tipouser=Request.Cookies("tipousuario");
nombreruta=Request.Cookies("NombreRuta");
claveruta=Request.Cookies("ClaveRuta");
ClaveaConsultar=Request.Cookies("ClaveaConsultar") ;


Consult=1;

curDir = Server.MapPath("p1.mdb");
Conexion = Server.CreateObject("ADODB.Connection");
Conexion.Open("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source=" +curDir);

function ValidaUsuario()
{

rs=Conexion.Execute("select programa as prog, sem as seman from MaestroVisitas where com ="+Consult);
if(!rs.eof)
{
supervisorConsultar=rs.fields("prog");
return true;
}
else
return false;
}

//creacion del reporte del reporte
function CreaReporteTienda()
{
sql="SELECT m.mvisFolio as folio, t.tiedescripcion as tienda, t.tiedireccion as ciud, format(m.mvisfechahorainicio,'HH:MM:SS') as horai, format(m.mvisfechahorafin,'HH:MM:SS') as horaf, s.supnombre as demo, sum(dt.detprototalventas) as totalventas, m.Semana as seman, m.mvisobservaciones as mvispro, m.mvisobservacionescom as mviscom FROM supervisores s, tiendas t, maestrovisitas m,detalleproductos dt WHERE t.tieclave=m.tieClave and m.supclave=s.SupClave and m.mvisfolio=dt.mvisfolio and m.com="+Consult+" group by t.tiedescripcion, m.mvisfechahorainicio, m.mvisfechahorafin, s.supnombre, m.mvisfolio, m.semana, m.mvisobservaciones, m.mvisobservacionescom, t.tiedireccion order by t.tiedireccion";
rs=Conexion.Execute(sql);
if (!rs.eof)
return true;

else
return false;
}

function BuscaPreguntasDemo()
{
folio=Request.Cookies("folio");
sql="select detDemPregunta as pregunta from detalledemo where mvisfolio='"+folio+"'";
Response.write(sql);
rsTemp=Conexion.Execute(sql);
if(!rsTemp.eof)
return true;
else
return false;
}
%>


<BODY topmargin=0 leftmargin=0>


<!--#include file="firma.asp"-->
<%
if (!firmado())
{
Response.redirect("acceso.asp");
}
%>

&nbsp;<p><!--[if gte vml 1]><v:shapetype id="_x0000_t202"
coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe">
<v:stroke joinstyle="miter"/>
<v:path gradientshapeok="t" o:connecttype="rect"/>
</v:shapetype><v:shape id="_x0000_s1026" type="#_x0000_t202" style='position:absolute;
left:256.5pt;top:110.25pt;width:357.75pt;height:27 .75pt;z-index:3' filled="f"
fillcolor="none" stroked="f" strokecolor="none">
<v:textbox>
<table cellspacing="0" cellpadding="0" width="95%" height="100%" id="table129">
<tr>
<td align="center">
<p><b><font color="#0000FF" size="4">Consulta de Comentarios por Semana</font></b></td>
</tr>
</table>
</v:textbox>
</v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout;position:
absolute;z-index:3;left:342px;top:147px;width:481px;height:41 px'><img
width=481 height=41 src="consulta4b116_files/image001.gif"
alt="Text Box: Consulta de Comentarios por Semana
" v:shapes="_x0000_s1026"></span><![endif]></p>
<p>&nbsp;</p>
<p></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p></p>
<p>
<!--#include file="tipou.asp"-->
<font size="2">
<BR>

&nbsp;</font></p>

<TABLE cellpadding=0 cellspacing=0 border=1 id="table149" width="1165">
<TR>
<%
// crecion del reporte
if (ValidaUsuario())
{
if(CreaReporteTienda())
{
folio=rs.fields("folio");
%>
<TD colspan=7 align=center height="26" bgcolor="#CCFFCC"><p class=etiquetan12>
<b><font face="Times New Roman" size="2">Persona que Consulta: <%=supervisorConsultar%></font></b><TR>
<TD bgcolor=#FFFFCC width="85" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">Ciudad </font> </TD>
<TD bgcolor=#FFFFCC width="182" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">Promotor </font> </TD>
<TD bgcolor=#FFFFCC width="156" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">Tienda </font> </TD>
<TD bgcolor=#FFFFCC width="144" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">Periodo </font> </TD>
<TD bgcolor=#FFFFCC width="300" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">Comentarios de Producto</font></TD>
<TD bgcolor=#FFFFCC width="300" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">Comentarios de Producto</font></TD>

<TD bgcolor=#CCFFCC width="288" height="20" align="center"><P class="etiquetan">
<font face="Times New Roman" size="2">
<span style="background-color: #CCFFCC">Comentarios de Competencia</span></font></TD><TR>

<%
while(!rs.eof)
{
%>
<TD width="85" height="24"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("ciud")%></font></TD>
<TD width="182" height="24"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("demo")%></font></TD>
<TD width="156" height="24"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("tienda")%></font></TD>
<TD width="144" height="24"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("seman")%></font></TD>
<TD width="300" height="24"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("mvispro")%></font></TD>
<TD width="300" height="24"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("mviscom")%></font></TD>
<TD width="288" height="24" style="color: #666699"><P class="etiquetan">
<font face="Times New Roman" style="font-size: 9pt"><%=rs.fields("horaf")%></font></TD><TR>
<% rs.movenext;
}
}
else
{
%>
<td width="85"><font size="2" face="Times New Roman">No hay comentarios: <%=supervisorConsultar%></font></TD><TR>
<TD align=center width="85"><font face="Times New Roman" size="2"><INPUT TYPE="button" class="boton" value="Regresar" onclick="window.location='Wrigley_comen.asp';"></font></TD>
<%
}
}
else
{
Response.redirect("erracceso.asp");
}
%>
</TABLE>
<p></p>
<font size="1">
<BR>
<!-- <TABLE border=1 cellpadding=0 cellspacing=0> -->
<!-- AQUI SE MOSTRARA EL SEGUNDO REPORTE: EVALUACION DE LA DEMO -->
<%
if (CreaReporteTienda())
{
while(!rs.eof)
{
sql="select detdemPregunta as pregunta, detDemRespuesta as respuesta from detalledemo where mvisFolio ='"+rs.fields("folio")+"'";
rsTemp=Conexion.Execute(sql);
if (!rsTemp.eof)
{
%>
</font>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<Th><font size="1"><%=rs.fields("tienda")%>
</font>
</TABLE>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0>
<%
while(!rsTemp.eof)
{
%>
<TD BGCOLOR=<%=bgcolor%>><P CLASS =etiquetan8>
<font size="1"><%=rsTemp.fields("pregunta")%></font></TD>
<%
rsTemp.movenext;
}
Response.Write("<TR>");
rsTemp.movefirst;

// hora ponemos las respuestas
while(!rsTemp.eof)
{
%>
<TD><P CLASS =etiquetan8><font size="1"><%=rsTemp.fields("Respuesta")%></font></TD>
<%
rsTemp.movenext;
}

Response.write("</TABLE>");
}
rs.movenext;
}
%>
<font size="2">
<INPUT TYPE="button" value="Regresar" class=boton onclick="window.location='Wrigley_comen_b.asp';"></font><font size="1">
<%
}
%>
</font>
</TABLE>
<p></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</HTML>