Código SQL:
Mi duda es, tengo que crear otra conexion a SQL y otros objetos? es decir otro como:Ver original
SELECT AVG(PESO) FROM pesos WHERE FECHA BETWEEN '2010-06-09 00:00:00.000' AND '2010-06-09 00:00:00.000' AND LINEA='L17S' AND codoptima=92
Código ASP:
Dejo mi codigo para aclarar mas dudasVer original
SET conexion=Server.CreateObject("ADODB.Connection") conexion.Open "PROVIDER=SQLOLEDB; DATA SOURCE=VALP-MESSRV0;UID=sa;PWD=;DATABASE=wasp " SET registros=Server.CreateObject("ADODB.RecordSet")
Código ASP:
Ver original
</tr> <% dim conexion,calendar1,calendar2,registros,linea calendar1=request.form("calendar1") calendar2=request.form("calendar2") linea=request.form("linea") Tubo=request.form("tubo") 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 if linea="1" Then registros.open"SELECT p.peso,p.vaso,p.fecha, o.linea,o.tubo FROM pesos as p, optimas as o where o.codigo = p.codOptima AND o.tubo LIKE '"&tubo&"' AND p.fecha Between '"&calendar1&"' AND '"&calendar2&"'order by fecha",conexion else registros.open"SELECT 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 = '"&linea&"' and o.tubo LIKE '"&tubo&"' AND p.fecha Between '"&calendar1&"' AND '"&calendar2&"'" ,conexion end if do while not registros.eof response.write("<tr>") response.write("<td>"®istros.fields("linea")&"</td>") response.write("<td>"®istros.fields("peso")&"</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 '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' %> </tr> </table> </table> </font></p>