Ver Mensaje Individual
  #6 (permalink)  
Antiguo 07/11/2005, 13:22
Lordztein
 
Fecha de Ingreso: abril-2002
Mensajes: 68
Antigüedad: 23 años, 1 mes
Puntos: 0
donde lo meto ??

el problema es que no se donde ponerlo ... no se mucho de codigo

este es un trozo de codigo que tengo para eliminar noticias, y lo que quiero es eliminar la fotografia relacionada a una noticia y la noticia de una sola vez.

a ver si me puedes mirar donde lo pongo para que se ejecute la accion .... Gracias de nuevo ( especialmente a ti Metallico )


Saludos

Código:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../../Connections/webgestcon.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Delete Record: declare variables

if (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_webgestcon_STRING
  MM_editTable = "gestnoticias"
  MM_editColumn = "Id"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "gesteliminar.asp"

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If
  
End If
%>
<%
' *** Delete Record: construct a sql delete statement and execute it

If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql delete statement
  MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the delete
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then 
  Recordset1__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_webgestcon_STRING
Recordset1.Source = "SELECT *  FROM menugest  WHERE activo = " + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_webgestcon_STRING
Recordset2.Source = "SELECT *  FROM gestnoticias  ORDER BY idioma ASC, fecha ASC"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = -1
Repeat2__index = 0
Recordset2_numRows = Recordset2_numRows + Repeat2__numRows
%>
<html>
<head>
<title>WEBGEST bY mongrafic</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../gestestilo.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="4">
  <tr> 
    <td height="304" bgcolor="#F4F4F4"> 
      <table width="750" align="center">
        <tr> 
          <td width="160" valign="top"> <p><font color="#00CCCC" size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
              <font color="#000000"><strong>:: menu</strong> </font></font></p>
            <% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
%>
            <table width="100%">
              <tr> 
                <td><font color="#00CCCC" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000" size="1"> 
                  :: <a href="../<%=(Recordset1.Fields.Item("enlace").Value)%>"><%=(Recordset1.Fields.Item("aptdo").Value)%></a> </font></font></td>
              </tr>
            </table>
            <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%> <p><font color="#000000" size="1" face="Verdana, Arial, Helvetica, sans-serif"></font></p>
            <p>&nbsp;</p></td>
          <td width="578" valign="top"> <p>&nbsp;</p>
            <% 
While ((Repeat2__numRows <> 0) AND (NOT Recordset2.EOF)) 
%>
            <form name="form1" method="POST" action="<%=MM_editAction%>">
              <table width="98%" border="0" align="center" cellpadding="0" cellspacing="2">
                <tr> 
                  <td colspan="2" bgcolor="#FFFFFF"> <div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><%=(Recordset2.Fields.Item("titulo").Value)%></strong></font></div></td>
                  <td width="23%" bgcolor="#FFFFFF"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=(Recordset2.Fields.Item("fecha").Value)%></font></div></td>
                  <td width="19%" bgcolor="#FFFFFF"><div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=(Recordset2.Fields.Item("idioma").Value)%></font></div></td>
                  <td width="19%" bgcolor="#FFFFFF"><div align="right"> 
                      <input name="imageField" type="image" src="../iconos/menos.gif" width="22" height="22" border="0">
                    </div></td>
                </tr>
              </table>
              <input type="hidden" name="MM_delete" value="form1">
              <input type="hidden" name="MM_recordId" value="<%= Recordset2.Fields.Item("Id").Value %>">
            </form>
            <% 
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  Recordset2.MoveNext()
Wend
%> <p>&nbsp;</p></td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
__________________
Lordztein