
30/07/2002, 10:37
|
| | Fecha de Ingreso: julio-2002
Mensajes: 219
Antigüedad: 22 años, 10 meses Puntos: 0 | |
Re: Por que da error en fechas? Disculpa la tardanza.
Aquí te anexo un código de una página de ejemplo, la cual hace lo que tu quieres.
Utilicé tu sentencia SQL y me funciona perfectamente.
<%@ Language=VBScript %>
<%Response.Buffer = true%>
<HTML>
<HEAD>
<%
function buscar(pFecha)
'Variable a utilizar
Dim objCon, strSQL, RS
'Conexión con la base de datos
Set objCon = Server.CreateObject("ADODB.Connection")
objCon.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("archivoDeDatos"))
'Verificando si hay una próxima pregunta
strSQL = "SELECT Fecha, Sum(Cantidad) AS TotCantidad, Sum(Cargo) AS TotCargo FROM Formularios Where Fecha=#" & pFecha & "# GROUP BY Fecha"
Set buscar = objCon.Execute(strSQL)
end function
%>
</HEAD>
<BODY>
<%
Dim RS, v
v = Request.Form("miFecha")
Response.Write("Fecha: " & v)
%>
<form id=form1 name=form1 action="aja.asp" method="post">
Fecha: <INPUT type="text" id="miFecha" name="miFecha"> <br>
<INPUT type="submit" value="Submit" id=submit1 name=submit1><br>
<%
if (v <> "") then
%>
<table BORDER="1" bgcolor="#FFFFFF" bordercolor="#003399">
<b>
<tr bgcolor="#000000">
<td>
<font color="#FFFFFF">
FECHA
</font>
</td>
<td>
<font color="#FFFFFF">
Total Cantidad
</font>
</td>
<td>
<font color="#FFFFFF">
Total Cargo
</font>
</td>
</tr>
</b>
<%
set RS = buscar(v)
while (not RS.Eof)
%>
<tr>
<td>
<font color="#000000">
<%Response.Write(RS("Fecha"))%>
</font>
</td>
<td>
<font color="#000000">
<%Response.Write(RS("TotCantidad"))%& gt;
</font>
</td>
<td>
<font color="#000000">
<%Response.Write(RS("TotCargo"))%& gt;
</font>
</td>
</tr>
<%
RS.MoveNext
wend
end if
%>
</table>
</form id=form1 name=form1>
</BODY>
</HTML>
Me imagino que ya sabes hacerlo, pero igual.
En la conexión a la base de datos, en donde dice archivoDeDatos coloca el nombre de tu base de datos.
Espero te sirva |