
14/12/2002, 15:31
|
 | | | Fecha de Ingreso: noviembre-2002 Ubicación: Madrid
Mensajes: 854
Antigüedad: 22 años, 5 meses Puntos: 0 | |
Bueno, sigo teniendo un problemilla. El codigo de la web es este:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<LINK href="../archivos/estilos.css" type=text/css rel=STYLESHEET>
<title>Square Games !</title>
</head>
<body>
<% dim strSQL, txtFecha
strSQL = "INSERT INTO NEWS (IMAGEN, ARCHIVO, FECHA) VALUES (' "&imgNews&" ','"&txtNews&"', '"&txtFecha&"')"
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open("Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("news.mdb"))
txtFecha = Date()
%>
<%
dim txtNews, imgNews
txtNews = Request.Form("txtNews")
imgNews = Request.Form("imgNews")
If txtNews <> "" And imgNews <> "" Then %>
<table>
<td>
<br>
<table cellspacing="0" cellpadding="5" width="485" vAlign="top" border="0">
<!--IMAGEN DESTACADA-->
<td width="135" vAlign="top">
<img src="<% response.write(imgNews)%>" width=135 height=135>
</TD>
<!-- FIN IMAGEN DESTACADA-->
<!-- CONTENIDO, 'TEXTO0'-->
<td width="327" vAlign="top">
<font class="NORMAL"><%response.write(txtNews)%></font>
</td>
<!-- FIN CONTENIDO, 'TEXTO'-->
<br>
</TABLE>
<form method="POST" action="<% Set grabar = MyConn.Execute("INSERT INTO NEWS (IMAGEN, ARCHIVO, FECHA) VALUES (' "&imgNews&" ','"&txtNews&"', '"&txtFecha&"')")%>">
<p><input type="Submit" value="Enviar" name="cmdActualizar"></p>
<% end if %>
</table>
<% If txtNews = "" Or imgNews = "" Then
response.write("<strong>Campo vacio, no se puede actualizar.</strong>")
end if
%>
</body>
</html>
Resulta que donde esta la sentencia set Grabar = myConn.execute(...) no puedo poner ahi una variable (por ejemplo strSQL), y tengo que guardar todos esos datos.
Ademas, cuando le doy al boton de aceptar, me lleva a esta misma pagina, y me pone "Campo vacio..." y juraria que me añade un registro vacio (en el campo ID, que es autonumerico.) Me gustaria que cuando le diese a enviar, se actualizase la DB y luego me llevase otra vez a la pagina de inicio, no a "comprobar.asp", que es la qeu tiene este codigo.
¿Alguien me ayuda a depurar el codigo?
Última edición por meru-kun; 14/12/2002 a las 15:41 |