Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/02/2010, 17:43
under_milox
 
Fecha de Ingreso: enero-2010
Mensajes: 15
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Actualizacion mediante checkbox

Este es el codigo que he estado usando
pero definitivamente no esta correcto




Código:
<%

set Con = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.MapPath("base.mdb")

txtSql ="SELECT * FROM Ventas where despachado=false and devuelto=false and nula=false "

Set Rs=Con.Execute(txtSql)

Do While Not Rs.EOF
If Rs("despachado") = true then
	color = "#99CCFF"
Else
	color = "#CCFFFF"
End if
%>

<tr bgColor= <%= color %>>

  <td><input name="folio5" id="folio5 "type ="hidden" value="<%=Rs("folio")%>" "></td>
  <td><%=Rs("folio")%></td>
<td><%=Rs("nombre")%></td>
<td><input name="folio1" type="checkbox" id="folio1" value=""></td>
<td><input name="folio2" type="checkbox" id="folio2" value="" ></td>
<td><input name="folio3" type="checkbox" id="folio3" value=""></td>
<td><input name="folio4" type="checkbox" id="folio4" value=""></td>
<td><%=Rs("Total")%></td></tr>

<%Rs.MoveNext
Loop
%>

Esto lo envia mediante formulario a "actualiza.asp"


actualiza.asp



Código:
if Request.Form("folio1")= true then
	txtSql="Update Ventas Set despachado = true Where folio in("&Request.Form("folio")&")"
	Set Rs=Con.Execute(txtSql)
			Mensaje = "Se actualizaron los registros "

end if
if Request.Form("folio2")= true then
	txtSql="Update Ventas Set pendiente = true Where folio In("&Request.Form("folio5")&")"	Set Rs=Con.Execute(txtSql)
			Mensaje = "Se actualizaron los registros "
end if

if Request.Form("folio3")= true then
	txtSql="Update Ventas Set devuelto = true Where folio In("&Request.Form("folio5")&")"
	Set Rs=Con.Execute(txtSql)
			Mensaje = "Se actualizaron los registros "
end if

if Request.Form("folio4")= true then
	txtSql="Update Ventas Set despachado = true Where folio In("&Request.Form("folio5")&")"
	Set Rs=Con.Execute(txtSql)
			Mensaje = "Se actualizaron los registros "
end if
			
			
	
%>
<body>
<script LANGUAGE="JavaScript">

var pagina="ComoHotmail.asp"
function redireccionar()
{
location.href=pagina
}
setTimeout ("redireccionar()", 0);

</script>
<%= Mensaje%>