Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/05/2005, 13:40
jorcri
 
Fecha de Ingreso: diciembre-2003
Mensajes: 120
Antigüedad: 21 años, 5 meses
Puntos: 0
bueno, no lo entiendo, lo siento, pero mis conociemientos de ASP son un poco justos, he desmontado y empezado de nuevo y sigue pasando lo mismo, no se como mandarle para que me borre el registro que le indico, pego todo el codigo a ver si podeis decirme que devo hacer, me sigue borrando el primer registro y no el que le indico:

Código:
<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="Connections/agencia.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
  MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}

// boolean to abort record edit
var MM_abortEdit = false;

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

if (String(Request("MM_delete")) == "formeliminarproducto" &&
    String(Request("MM_recordId")) != "undefined") {

  var MM_editConnection = MM_agencia_STRING;
  var MM_editTable = "productos_venta";
  var MM_editColumn = "Referencia";
  var MM_recordId = "" + Request.Form("MM_recordId") + "";
  var MM_editRedirectUrl = "eliminar_productos2.asp";

  // append the query string to the redirect URL
  if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
  }
}
%>
<%
// *** Delete Record: construct a sql delete statement and execute it

if (String(Request("MM_delete")) != "undefined" &&
    String(Request("MM_recordId")) != "undefined") {

  // create the sql delete statement
  MM_editQuery = "delete from " + MM_editTable + " where " + MM_editColumn + " = " + MM_recordId;

  if (!MM_abortEdit) {
    // execute the delete
    var 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) {
      Response.Redirect(MM_editRedirectUrl);
    }
  }

}
%>
<%
var eliminar_produc = Server.CreateObject("ADODB.Recordset");
eliminar_produc.ActiveConnection = MM_agencia_STRING;
eliminar_produc.Source = "SELECT * FROM productos_venta";
eliminar_produc.CursorType = 0;
eliminar_produc.CursorLocation = 2;
eliminar_produc.LockType = 1;
eliminar_produc.Open();
var eliminar_produc_numRows = 0;
%>
y en el formulario:

Código:
 
<form ACTION="<%=MM_editAction%>" METHOD="post" name="formeliminarproducto" id="formeliminarproducto">
<table width="100%"  border="0" cellpadding="0" cellspacing="0" class="Estilo4">
<tr>
<td width="36%"><div align="center">N&ordm; Referencia a eliminar:
</div></td>
<td width="60%"><div align="left">
<select name="Refe" size="1" id="Refe">
<% 
while (!eliminar_produc.EOF) {
%>
<option value="<%=(eliminar_produc.Fields.Item("Referencia").Value)%>"><%=(eliminar_produc.Fields.Item("Referencia").Value)%>
</option>
<%
eliminar_produc.MoveNext();
}
if (eliminar_produc.CursorType > 0) {
if (!eliminar_produc.BOF) eliminar_produc.MoveFirst();
} else {
eliminar_produc.Requery();
}
%>
</select>
lo siento pero no se hacerlo, gracias de todas formas por la ayuda.
__________________
jorcri...