
21/06/2002, 15:10
|
| | Fecha de Ingreso: mayo-2002
Mensajes: 75
Antigüedad: 23 años Puntos: 0 | |
Nesecito Ayuda para ingresar datos a la BD NESECITO AYUDA CON ESTE PROGRAMA NO ME INGRESA LOS DATOS A LA BASES DE DATOS EN ACCESS AQUI MANDO EL CODIGO PARA QUE ME AYUDEN A SOLUCIONARLO <%@language=VBscript%>
<%
set cn=Server.CreateObject("ADODB.connection" ;)
cn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("noticias.mdb")
dim titulo,texto,autor,email,fecha,foto
dim miconexion,mirecordset,miconsulta,numero_propuesta
autor = Request.Form("autor")
email = Request.Form("email")
titulo = Request.Form("titulo")
texto = Request.Form("texto")
fecha = Request.Form("fecha")
foto = Request.Form("foto")
if (autor = "") and (email = "") and (titulo = "") and (texto = "") then
else
set mirecordset = server.CreateObject("ADODB.RECORDSET")
'miconsulta = "noticias"
mirecordset.LockType = adLockOptimistic
mirecordset.CursorType = adOpenKeyset
mirecordset.ActiveConnection = cn
mirecordset.Source = "noticias"
mirecordset.Open
on error resume next
mirecordset.movelast()
if err <> 0 then
end if
numero_propuesta = mirecordset.fields("id_noticia")
n_prop = numero_propuesta + 2
sql = "INSERT INTO PROPUESTAS (id_noticia, autor, email_autor, titulo, texto, fecha, foto) VALUES ("&n_prop&",'"&autor&am p;"','"&email&"','"&am p;titulo&"','"&texto&"' ,'"&date()&"','"&foto&a mp;"')"
cn.Execute sql,,1
response.write(sql)
response.write("datos")
'cn.execute(sql)
' Response.Redirect("propuesta_enviada.asp" ;)
mirecordset.close
end if
%>
<font face=Arial size=2>
<p><font face="Arial" size="2"><b>NOTICIAS : AGREGAR NOTICIAS</b></font></p>
<font face=Arial size=2>Para ingresar noticias en su seccion definida para noticias, complete todos los campos del
siguiente formulario y presione "Publicar".<br>
<form name="FORMULARIO" method="post" ACTION="n_agregar.asp">
<table WIDTH="500" BORDER="1" CELLSPACING="0" CELLPADDING="2">
<tr>
<td width="91"><font face="Arial" size="2"><b>Autor : </b></font></td>
<td width="324"> <font face="Arial" size="2">
<input type="text" name="autor" size=40 maxlength="255">
</font></td>
</tr>
<tr>
<td width="91"><font face="Arial" size="2"><b>Email :</b></font></td>
<td width="324"><font face="Arial" size="2">
<input type="text" name="email" size=40 maxlength="255">
</font></td>
</tr>
<tr>
<td width="91"><font face="Arial" size="2"><b>T&iacute;tulo:& lt;/b></font></td>
<td width="324"> <font face="Arial" size="2">
<input type="text" name="titulo" size=40 MAXLENGTH="255">
</font></td>
</tr>
<tr>
<td valign=top width="91"><font face="Arial" size="2"><b>Texto:</b></font></td>
<td width="324"> <font face="Arial" size="2">
<textarea name="texto" cols=50 rows=10></textarea>
</font></td>
</tr>
<tr>
<td width="91"><font face="Arial" size="2"><b>Fecha : </b></font></td>
<td width="324">
<input type="text" name="fecha">
</td>
</tr>
<tr>
<td width="91"><font face="Arial" size="2"><b>Foto : </b></font></td>
<td width="324">
<input type="file" name="foto">
</td>
</tr>
<tr>
<td width="91"><font face="Arial" size="2"><br>
</font></td>
<td width="324"> <font face="Arial" size="2">
<input type="submit" value=" Publicar " name="agregar">
</font></td>
</tr>
</table>
</form>
</font></font> |