Foros del Web » Programando para Internet » ASP Clásico »

Borra datos en pagina con 2 botones

Estas en el tema de Borra datos en pagina con 2 botones en el foro de ASP Clásico en Foros del Web. Hola a todos Tengo una pagina para modificar datos con 2 botones, uno para mostrar datos de una tabla segun un nro que me ingresan ...
  #1 (permalink)  
Antiguo 24/04/2009, 21:55
 
Fecha de Ingreso: febrero-2007
Mensajes: 139
Antigüedad: 18 años, 3 meses
Puntos: 0
Borra datos en pagina con 2 botones

Hola a todos

Tengo una pagina para modificar datos con 2 botones, uno para mostrar datos de una tabla segun un nro que me ingresan y otro para modificar los datos que se hayan mostrado.

El problema es que cuando doy clic en el boton de modificar se me borran los datos que habia mostrado tanto en la pagina como en el vector donde los guardo.

Que puedo hacer para evitar que se me borren los datos??

De antemano muchas gracias al que me pueda colaborar.
  #2 (permalink)  
Antiguo 25/04/2009, 08:30
 
Fecha de Ingreso: febrero-2009
Mensajes: 33
Antigüedad: 16 años, 2 meses
Puntos: 1
Respuesta: Borra datos en pagina con 2 botones

Si muestras tu codigo creo que te podria ayudar : )
  #3 (permalink)  
Antiguo 27/04/2009, 08:14
 
Fecha de Ingreso: febrero-2007
Mensajes: 139
Antigüedad: 18 años, 3 meses
Puntos: 0
Respuesta: Borra datos en pagina con 2 botones

HOLA,
Adjunto el codigo. Hay mas opciones para modificar pero me tocó quitarlas porque el foro solo me permite cierto nro de caracteres. Lo raro es que a veces me modifica, por que?

De antemano muchisimas gracias.

Código HTML:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Batch.asp" -->
<!--#include file="Connections/BatchReport.asp" -->
<html>
<head>
<title>Modificar Molienda</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.style6 {
	font-size: small;
	font-family: Arial, Helvetica, sans-serif;
}
.style23 {
	text-align: center;
}
.style8 {
	text-align: center;
	color: #006633;
	font-family: Arial;
	font-weight: bold;
	border: 1px solid #006633;
	font-size: small;
}
.style24 {
	text-align: center;
	color: #006633;
	font-family: Arial;
	font-weight: bold;
	border: 1px solid #006633;
}
.style3 {
	text-align: left;
}
.style2 {
	color: #006633;
}
.style1 {
	color: #006633;
}
.style5 {
	font-family: Arial;
}
.style22 {
	font-size: small;
}
.style25 {
	color: #009933;
}
.style27 {
	text-align: left;
	color: #006633;
	font-family: Arial;
	font-weight: bold;
	border: 1px solid #006633;
}
.style29 {
	font-family: Arial;
	font-weight: normal;
	color: #006633;
}
.style36 {
	border: 1px solid #006633;
	text-align: center;
}
</style>
</head>

<body>
<form name="form1" method="POST" action style="text-align: center">
	<input type="hidden" name="Batch1" size="20" value = "<%=batch%>" >
  <table style="WIDTH: 165px; HEIGHT: 61px; font-style:normal; font-variant:normal; font-weight:normal; font-size:8pt; font-family:verdana" bordercolor="#009933"
  cellspacing="2" cellpadding="4" align="center" border="1">
<tbody>
    <tr align="center">
      <td nowrap="nowrap" style="height: 35px; " class="style23">
		<font color="#006633"><span class="style6"><strong>NúmCto:</strong></span></font><strong>&nbsp;  
</strong>
		<input type="text" name="Cto" size="14" style="width: 64px; height: 22px;"></td>
    </tr>
    <tr align="center">
      <td nowrap="nowrap" style="height: 35px; " class="style23">
	<input type="submit" name="Buscar" value="Buscar"></td>
    </tr>
    </table>
	<font size="3" color="#009933">		
		<table class="style6" style="width: 852px">
		<tr>
			<td class="style8" style="width: 2376px; height: 11px;">MOLIENDA</td>
			<td class="style8" style="width: 5117px; height: 11px;">MATERIAL</td>
			<td class="style8" style="width: 2388px; height: 11px;"><font size="3">
			SILO MALT</font></td>
			<td class="style8" style="width: 1629px; height: 11px;"><font size="3">
			SILO PPAL </font></td>
			<td class="style8" style="width: 1135px; height: 11px;">CANT</td>
			<td class="style24" style="width: 1237px; height: 11px;">AGUA&nbsp;</td>
		</tr>
		<%Dim Consulta
		Set Consulta= Server.CreateObject("ADODB.Recordset")
		Consulta.ActiveConnection =  MM_Batch_STRING
		Consulta.Source = "SELECT mi.material_name, mi.unitprocedure_id, mi.unitorconnection, MI.actual_qty, PV.Actual_Value, MI.Mtrl_Batch_ID FROM dbo.MaterialInput MI inner join dbo.ProcessVar PV on MI.Batch_Log_ID = PV.Batch_Log_ID WHERE MI.Material_ID like '100048%'  and PV.Actual_Value <> ' ' AND  PV.Phase_Instance_ID = MI.Phase_Instance_ID AND  PV.Phase_label = MI.Phase_label AND  mi.unitprocedure_id =  pv.unitprocedure_id AND  MI.Batch_Log_ID =  " +Batch+  " ORDER BY  mi.datetime, mi.unitprocedure_id, mi.material_name " 
		Consulta.CursorType = 0
		Consulta.CursorLocation = 2
		Consulta.LockType = 1
		Consulta.Open()
		if (Not Consulta.eof) then
			Consulta.movefirst()
			sw=0
			i=0
			acumula = 1
			Do while (Not Consulta.eof)	
				molienda1	= Consulta.fields.item("unitprocedure_id").value
				material1	= Consulta.fields.item("Material_Name").value
				PPAL1		= Consulta.fields.item("Mtrl_Batch_ID").value
				SILO1 		= Consulta.fields.item("UnitOrConnection").value
				cant1 		= Consulta.fields.item("Actual_QtY").value
				h2o1		= Consulta.fields.item("actual_value").value
				if sw = 0 then
					sw = 1
					Tabla (0,i)= molienda1
					Tabla (1,i)= material1
					Tabla (2,i)= ppal1
					Tabla (3,i)= silo1
					Tabla (4,i)= cant1 
					Tabla (5,i)= h2o1
					Tabla (7,i)= acumula 
					acumula = 1
					i=i+1
				else
					if Tabla (0,i-1)= molienda1 AND Tabla (1,i-1)= material1 then
						'--silo igual--
						if silo1 = Tabla (3,i-1) then
							'--agua igual--
							if Tabla (5,i-1)= h2o1 then
								h2o1 = 0
							end if	
							acumula =acumula +1
							Tabla (4,i-1) = Tabla (4,i-1)+ cant1
							Tabla (5,i-1) = Tabla (5,i-1)+ cint(h2o1)
							Tabla (7,i-1) = acumula
							acumula =1
						else
							'---NUEVA MOLIENDA--
							Tabla (0,i)= molienda1
							Tabla (1,i)= material1
							Tabla (2,i)= ppal1
							Tabla (3,i)= silo1
							Tabla (4,i)= cant1 
							Tabla (5,i)= h2o1
							Tabla (7,i)= acumula 
							acumula = 1
							i=i+1
						end if		
					else
						'---NUEVA MOLIENDA--
						Tabla (0,i)= molienda1
						Tabla (1,i)= material1
						Tabla (2,i)= ppal1
						Tabla (3,i)= silo1
						Tabla (4,i)= cant1 
						Tabla (5,i)= h2o1
						Tabla (7,i)= acumula 
						acumula = 1
						i=i+1
					end if
				end if
			Consulta.movenext()
			loop
			final = i-1
			Consulta.Close()
			Set Consulta= Nothing
			for i = 0 to final%>
			   <tr>
			  		<td class="style36" style="width: 2376px">
					<input name="radio" type="radio" value="<%=i%>"><%Response.write "&nbsp;"%><%Response.write Tabla (0,i)%></td>
					<td class="style36" style="width: 5117px"><%Response.write Tabla (1,i)%></td>
					<td class="style36" style="width: 2388px"><%Response.write Tabla (2,i)%></td>
					<td class="style36" style="width: 1629px"><%Response.write Tabla (3,i)%></td>
					<td class="style36" style="width: 1135px"><%Response.write Tabla (4,i)%></td>
					<td class="style36" style="width: 1237px"><%Response.write Tabla (5,i)%></td>
				</tr>
			   <%tabla (6,i) = i
			next
			Session("S_Tabla") = Tabla
			Session("S_Batch") = Batch
			Session("S_final") = final
		end if
	end if
end if%> 
</table>
</FONT>
<font size="3" color="#009933">
<table style="WIDTH: 337px; HEIGHT: 65px; font-style:normal; font-variant:normal; font-weight:normal; font-size:8pt; font-family:verdana" bordercolor="#009933" cellpadding="4" align="center" border="1" cellspacing="2">
	<tbody>
	<tr align="center">
		<td class="style27" style="height: 31px; width: 16px">
		<font size="3" color="#009933"><strong><span class="style5"><span class="style22"><span class="style25"><span class="style2">
		<input type="checkbox" name="C1" value="ON" style="width: 20px; height: 20px;"></span></span></span></span></strong></font></td>
		<td class="style24" style="height: 31px; width: 174px">
		<font size="3" color="#009933"><span class="style29">Cantidad</span><strong> </strong></font></td>
		<td class="style24" style="height: 31px"><font face="Arial" size="3" color="#009933">
		<span class="style2"><span class="style3"><span class="style1"><strong><span class="style5">
		<input type="text" name="cantidadmolienda"size="20" style="width: 77px; height: 27px"></span></strong></span></span></span></font></td>
	 </tr>
	<tr align="center">
		<td height="34" class="style5" colspan="3">
		<input type="submit" name="MODIFICAR" value="MODIFICAR"></td>
	</tr>
	</table></font>
</form>
<%If request.form("MODIFICAR") = "MODIFICAR" then
	Tabla	= Session ("S_Tabla")
	Batch	= Session ("S_Batch")
	Final	= Session ("S_Final")
	if request.ServerVariables("REQUEST_METHOD")="POST" then
		j=0
		for each control in request.form
			if j= 2 then
		   	  opcion = request.form(control)
		   	end if 
			j=j+1
		next	
		opcion = "'" & Replace(opcion, "'", "''") &  "'"
		for i = 0 to Final
			num = "'" & Replace(tabla(6,i), "'", "''") &  "'"
			if opcion = num then
				molienda1	= Tabla(0,i)
				material1	= Tabla(1,i)
				silomal1	= Tabla(2,i)
				siloppal1	= Tabla(3,i)
				cant1		= Tabla(4,i)
				agua1		= Tabla(5,i)
				acumula		= Tabla(7,i)
				exit for
			end if	
		next
		notas 		= "'" & Replace(request.form("notas"), "'", "''") &  "'"
		molienda1 	= "'" & Replace(molienda1, "'", "''") &  "'"
		siloppal1 	= "'" & Replace(siloppal1, "'", "''") &  "'"
		Dim UpDateValue	
		if request.form("C1") = "ON" then
			dato 			= request.form("cantidadmolienda")/acumula
			dato 			= "'" & Replace(dato, "'", "''") &  "'"
			set UpDateValue= Server.CreateObject("ADODB.Command")
			UpDateValue.ActiveConnection = MM_Batch_STRING
			UpDateValue.CommandText = "UPDATE dbo.MaterialInput SET Actual_Qty = "&dato& " WHERE Material_ID like '100048%' AND unitprocedure_id =  "+molienda1 +" AND UNITORCONNECTION =  "+siloppal1 +" AND Batch_Log_ID = "+Batch+" "
			UpDateValue.CommandType = 1
			UpDateValue.CommandTimeout = 0
			UpDateValue.Prepared = true
			UpDateValue.Execute()
		end if
	end if
end if%>
</body>
</html> 
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:05.