Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2007, 04:30
potenkin
 
Fecha de Ingreso: septiembre-2005
Mensajes: 202
Antigüedad: 19 años, 7 meses
Puntos: 0
Inclusion por duplicado de la misma referencia

Hola,
tengo un simple sistema de noticias montado con ACCES y Vscript, y me pasa una cosa curiosa, cada vez que incluyo una noticia nueva via formulario, se incluyen 2 a la vez, he estado repasando y no veo el error, alguien podria ayudarme? gracias

adjunto el codigo:
------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/femel.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form") Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_femel_STRING
MM_editCmd.CommandText = "INSERT INTO noticia (seccion, titcat, textcat, titesp, textesp, fecha, foto) VALUES (?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("select")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 100, Request.Form("titolcat")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 203, 1, 1073741823, Request.Form("textcat")) ' adLongVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 100, Request.Form("titulocast")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 203, 1, 1073741823, Request.Form("textocast")) ' adLongVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 202, 1, 50, Request.Form("fecha")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 203, 1, 1073741823, Request.Form("imagen")) ' adLongVarWChar
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "afegir_noticia.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_femel_STRING
Recordset1_cmd.CommandText = "SELECT * FROM noticia"
Recordset1_cmd.Prepared = true

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>

<SCRIPT LANGUAGE="JavaScript">
<!--
function Enviar(form) {
for (i = 0; i < form.elements.length; i++) {
if (form.elements[i].type == "text" && form.elements[i].value == "") {
alert("Si us plau ompliu tots els camps del formulari"); form.elements[i].focus();
return false; }
}
form.submit();
}
// -->
</SCRIPT>


<link href="panel.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="600" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="10%">&nbsp;</td>
<td width="90%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="titulo">Afegir Not&iacute;cia </td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form">
<table width="450" align="left" cellpadding="3" class="txt">

<tr valign="baseline">
<td nowrap align="right">Tipus Not&iacute;cia </td>
<td><select name="select">
<option value="actualidad" selected>Actualitat</option>
<option value="documentacion">Documentaci&oacute;</option>
<option value="fiscal">Fiscal</option>
<option value="laboral">Laboral</option>
</select></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">T&iacute;tol cat:</td>
<td> <input name="titolcat" type="text" id="titolcat" value="" size="30"> </td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Text cat:</td>
<td> <textarea name="textcat" cols="30" rows="5" id="textcat"></textarea> </td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">T&iacute;tol cast.:</td>
<td><input name="titulocast" type="text" id="titulocast" value="" size="30"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap>Text cast:</td>
<td><textarea name="textocast" cols="30" rows="5" id="textocast"></textarea> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Data:</td>
<td> <input type="text" name="fecha" value="" size="20">
per ex. 12/01/07</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Foto:</td>
<td> <input name="imagen" type="text" id="imagen" value="" size="20">
-&gt; <a href="#" onClick="MM_openBrWindow('subir_imagen.html','','w idth=450,height=200')">Pujar
foto</a></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td>En el cas que no hi hagi foto, posar &quot;nofoto&quot; </td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td> <input type="submit" value="Afegir not&iacute;cia" onClick="return Enviar(this.form)"> </td>
</tr>
</table>



<input type="hidden" name="MM_insert" value="form">
</form>
<p>&nbsp;</p></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>