
03/08/2005, 15:03
|
 | Moderador | | Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 23 años, 4 meses Puntos: 98 | |
Trata este apprpach:
Código:
<%
Dim rsFact, sqlFact
Dim rsFact_numRows
Set rsFact = Server.CreateObject("ADODB.Recordset")
rsFact.ActiveConnection = MM_ConFactura_STRING
rsFact.Source = "SELECT * FROM Factura WHERE Bandera='" & 0 & "'"
rsFact.CursorType = 0
rsFact.CursorLocation = 2
rsFact.LockType = 1
rsFact.Open()
rsFact_numRows = 0
Dim cmdUpDate, sqlUp
Set cmdUpDate = Server.CreateObject("ADODB.Command")
Dim rsCMKArt
Dim rsCMKArt_numRows
dim vardesc
Set rsCMKArt = Server.CreateObject("ADODB.Recordset")
rsCMKArt.ActiveConnection = MM_ConD84_STRING
rsCMKArt.CursorType = 0
rsCMKArt.CursorLocation = 2
rsCMKArt.LockType = 1
if not rsFact.EOF
ds = rsFact.GetRows()
else
ds = Null
end if
Set rsFact = Nothing
if isArray(ds) then
for j = 0 to uBound(ds,2)
vardesc = ds(numero_de_campo_descripcion, j)
rsCMKArt.Source = "SELECT los_campos_que_necesites_unicamente FROM Articulos Where Descripcion = '" & TRIM(ds(numero_campo_descripcion, j)) & "'"
rsCMKArt.Open()
if Not rsCMKArt.EOF then
dsCMK = rsCMKArt.GetRows()
rsCMKArt.Close
sqlUp = "UPDATE Factura Set ClaveArtCMK= ' " & dsMCK(numero_campo_clave,j) &" ' Where Descripcion='" & TRIM(ds(numero_campo_descripcion, j)) & " ' "
cmdUpDate.ActiveConnection = MM_ConFactura_STRING
cmdUpdate.CommandType = 1
cmdUpDate.CommandText = sqlUp
cmdUpDate.CommandTimeout = 0
cmdUpDate.Execute
erase dsCMK
else
response.Write("no encontro el articulo en la tabla articulos")
response.Write("<BR>")
sqlUp = "UPDATE Factura Set ClaveArtCMK= ' 00000 ' Where Descripcion='" & TRIM(ds(numero_campo_descripcion, j)) & " ' "
cmdUpDate.ActiveConnection = MM_ConFactura_STRING
cmdUpdate.CommandType = 1
cmdUpDate.CommandText = sqlUp
cmdUpDate.CommandTimeout = 0
cmdUpDate.Execute
end if
next
erase ds
end if
%>
Si se queda colgado, entonces creo que la solucion mas viable sera encapsular este procedimiento en un stored procedure, o indexar esa tabla.
Salu2,
__________________ "El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway |