ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/Mes/Asp/was2/more2.asp, line 99
Mi codigo es:
La linea que marca el error es la: do while not registros.eof(la numero 24 de este codigo acontinuacion
Código ASP:
Espero puedan hecharme una manita :( Ver original
<% dim conexion,calendar1,calendar2,registros,linea,hora,test calendar1=request.form("calendar1") calendar2=request.form("calendar2") linea=request.form("linea") Tubo=request.form("tubo") hora=request.form("hora") test=("SELECT h.hora,h.marca,h.codoptima,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o,htargets as h where o.codigo = p.codOptima and o.linea = '"&linea&"' and o.tubo LIKE '"&tubo&"' AND p.fecha Between '"&calendar1&"' AND '"&calendar2&"' AND p.hora='"&hora&"'and h.codoptima = o.codigo and h.hora='"&hora&"'") SET conexion=Server.CreateObject("ADODB.Connection") conexion.Open "PROVIDER=SQLOLEDB; DATA SOURCE=VALP-MESSRV02;UID=sa;PWD=messrv;DATABASE=wasp " SET registros=Server.CreateObject("ADODB.RecordSet") 'registros.open"SELECT peso,tubo from pesos where fecha between '"&calendar1&"' AND '"&calendar2&"'",conexion registros.open"SELECT h.hora AS hora1,h.marca,h.codoptima AS codoptimaT,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha,o.linea,o.tubo INTO #c FROM pesos AS p, optimas AS o,htargets AS h WHERE o.codigo = p.codOptima AND o.linea = '"&linea&"' AND o.tubo ='"&tubo&"' AND p.fecha BETWEEN '"&calendar1&"' AND '"&calendar2&"' AND p.hora='"&hora&"' AND h.codoptima = o.codigo AND h.hora='"&hora&"'",conexion 'EN USO-->'registros.open"SELECT h.hora,h.marca,h.codoptima,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o,htargets as h where o.codigo = p.codOptima and o.linea = '"&linea&"' and o.tubo ='"&tubo&"' AND h.fecha Between '"&calendar1&"' AND '"&calendar2&"' AND p.fecha Between '"&calendar1&"' AND '"&calendar2&"' AND p.hora='"&hora&"'and h.codoptima = o.codigo and h.hora='"&hora&"'" ,conexion 'registros.open"SELECT p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o where o.codigo = p.codOptima and o.linea = 'L15N' and o.tubo LIKE '%' AND p.fecha Between '2010-06-14 09:00:00.000' AND '2010-06-14 09:30:00.000' AND p.hora='9:00 - 9:30'" ,conexion 'SELECT h.codoptima,h.target,P.CODOPTIMA,O.CODIGO,p.hora,p.peso,p.vaso,p.fecha, o.linea,o.tubo,o.codigo FROM pesos as p, optimas as o,htargets as h where o.codigo = p.codOptima and o.linea = 'L07N' and o.tubo LIKE '%' AND p.fecha Between '2010-06-14 09:30' AND '2010-06-14 10:00' AND p.hora='9:30 - 10:00' and h.codoptima = o.codigo dim a do while not registros.eof a=cint(registros.fields("target")) response.write("<tr>") response.write("<td>"®istros.fields("linea")&"</td>") response.write("<td>"®istros.fields("peso")&"</td>") response.write("<td>"®istros.fields("target")&"</td>") 'response.write("<td>"&a&"</td>") response.write("<td>"®istros.fields("marca")&"</td>") response.write("<td>"®istros.fields("vaso")&"</td>") response.write("<td>"®istros.fields("tubo")&"</td>") response.write("<td>"®istros.fields("fecha")&"</td>") registros.movenext loop conexion.close 'response.write(test) '<--Test Debug 'RESPONSE.WRITE("<br>") dim codoptima if linea="L01N" AND tubo="A" then codoptima=30 elseif _ linea="L01N" AND tubo="B" then codoptima=31 elseif linea="L01N" AND tubo="C" then codoptima=32 elseif linea="L01S" AND tubo="D" then codoptima=33 elseif linea="L01S" AND tubo="E" then codoptima=34 elseif linea="L01S" AND tubo="F" then codoptima=35 elseif linea="L02N" AND tubo="A" then codoptima=54 elseif linea="L02N" AND tubo="B" then codoptima=55 elseif linea="L02N" AND tubo="C" then codoptima=56 elseif linea="L02N" AND tubo="D" then codoptima=57 elseif linea="L02N" AND tubo="E" then codoptima=58 elseif linea="L02N" AND tubo="F" then codoptima=59 elseif linea="L03N" AND tubo="A" then codoptima=60 elseif linea="L03N" AND tubo="B" then codoptima=61 elseif linea="L03N" AND tubo="C" then codoptima=62 elseif linea="L03S" AND tubo="D" then codoptima=63 elseif linea="L03S" AND tubo="E" then codoptima=64 elseif linea="L03S" AND tubo="F" then codoptima=65 elseif linea="L06N" AND tubo="A" then codoptima=36 elseif linea="L06N" AND tubo="B" then codoptima=37 elseif linea="L06N" AND tubo="C" then codoptima=38 elseif linea="L06S" AND tubo="D" then codoptima=39 elseif linea="L06S" AND tubo="E" then codoptima=40 elseif linea="L06S" AND tubo="F" then codoptima=41 elseif linea="L07N" AND tubo="A" then codoptima=42 elseif linea="L07N" AND tubo="B" then codoptima=43 elseif linea="L07N" AND tubo="C" then codoptima=44 elseif linea="L07S" AND tubo="D" then codoptima=45 elseif linea="L07S" AND tubo="E" then codoptima=46 elseif linea="L07S" AND tubo="F" then codoptima=47 elseif linea="L09N" AND tubo="A" then codoptima=48 elseif linea="L09N" AND tubo="B" then codoptima=49 elseif linea="L09N" AND tubo="C" then codoptima=50 elseif linea="L09S" AND tubo="D" then codoptima=51 elseif linea="L09S" AND tubo="E" then codoptima=52 elseif linea="L09S" AND tubo="F" then codoptima=53 elseif linea="L14N" AND tubo="A" then codoptima=76 elseif linea="L15N" AND tubo="A" then codoptima=82 elseif linea="L15N" AND tubo="B" then codoptima=83 elseif linea="L15N" AND tubo="C" then codoptima=84 elseif linea="L15S" AND tubo="D" then codoptima=85 elseif linea="L15S" AND tubo="E" then codoptima=86 elseif linea="L15S" AND tubo="F" then codoptima=87 elseif linea="L16N" AND tubo="A" then codoptima=88 elseif linea="L16N" AND tubo="B" then codoptima=89 elseif linea="L16N" AND tubo="C" then codoptima=90 elseif linea="L16S" AND tubo="D" then codoptima=91 elseif linea="L16S" AND tubo="E" then codoptima=92 elseif linea="L16S" AND tubo="F" then codoptima=93 elseif linea="L17N" AND tubo="A" then codoptima=94 elseif linea="L17N" AND tubo="B" then codoptima=95 elseif linea="L17N" AND tubo="C" then codoptima=96 elseif linea="L17S" AND tubo="D" then codoptima=97 elseif linea="L17S" AND tubo="E" then codoptima=98 elseif linea="L17S" AND tubo="F" then codoptima=99 elseif linea="L19N" AND tubo="A" then codoptima=104 elseif linea="L19N" AND tubo="B" then codoptima=102 elseif linea="L19N" AND tubo="C" then codoptima=103 end if 'SELECT p.peso,p.tubo,p.fecha, o.linea FROM pesos as p, optimas as o where o.codigo = p.codOptima and o.linea = 'L02N' AND p.fecha Between '2010-05-11 09:42:34.000' AND '2010-05-11 09:42:39.000' SET conexion2=Server.CreateObject("ADODB.Connection") conexion2.Open "PROVIDER=SQLOLEDB; DATA SOURCE=VALP-MESSRV02;UID=sa;PWD=messrv;DATABASE=wasp " SET registros2=Server.CreateObject("ADODB.RecordSet") registros2.open"SELECT AVG(PESO)as peso from pesos where fecha Between '"&calendar1&"' AND '"&calendar2&"'AND hora='"&hora&"' AND codoptima='"&codoptima&"'",conexion2 'RESPONSE.WRITE("SELECT AVG(PESO)as peso from pesos where fecha Between '"&calendar1&"' AND '"&calendar2&"'AND hora='"&hora&"' AND codoptima='"&codoptima&"'") do while not registros2.eof c=cint(registros2.fields("peso")) b=(a-c)/a response.write("Promedio: "®istros2.fields("peso")&"") '############## Aritmetica #################### ' C = Promedio WHERE B=(a-c)/a ' A = Target response.write("<br> Op: "&b&"<br>") saving=(c-a) registros2.movenext loop conexion2.close %>