Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/04/2012, 04:27
musu143
 
Fecha de Ingreso: abril-2012
Mensajes: 20
Antigüedad: 12 años
Puntos: 1
Respuesta: URGENTE:capturar datos para actualizar consulta

Hay un erro en el codigo que he copiado, en realidad es asi, te marco en otro color lo que he cambiado:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Conexion1.asp" -->
<%

Dim Ad
Dim Ad_numRows
Dim Repeat1__numRows
Dim Repeat1__index
Dim fac
Dim uni
Dim numPlaz

Repeat1__numRows = -1
Repeat1__index = 0
Ad_numRows = Ad_numRows + Repeat1__numRows

Set Ad = Server.CreateObject("ADODB.Recordset")
Ad.ActiveConnection = MM_Conexion1_STRING
Ad.Source = "SELECT * FROM Admitidos"
Ad.CursorType = 0
Ad.CursorLocation = 2
Ad.LockType = 1
Ad.Open()
Ad_numRows = 0
%>
<%

set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_Conexion1_STRING
Command1.CommandText = "UPDATE [Admitidos] SET NOTA= 30, CANDIDATO=true, SUPLENTE=true WHERE UNIVERSIDAD= '" + Replace(uni, "'", "''") + "' AND FACULTAD='" + Replace(fac, "'", "''") + "' ;"

Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
%>
<html>
<head>
</head>
<body>

<% While ((Repeat1__numRows <> 0) AND (NOT Ad.EOF)) %>

<BR><%fac=(Ad.Fields.Item("FACULTAD").Value)%><B R />
<BR><%uni=(Ad.Fields.Item("UNIVERSIDAD").Value)%>< B R />
<BR><%numPlaz=(Ad.Fields.Item("NUM PLAZAS").Value)%><BR />

<%
If (numPlazas <> "") Then
Command1.Execute()
End If
%>


<%Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Ad.MoveNext()%>
<%WEND%>

</body>
</html>
<%
Ad.Close()
Set Ad = Nothing
%>

Las variables me las recoje bien porque con un response.write me las va escribiendo en pantalla, lo que no me las pasa a la consulta sql, ¿alguna idea?