Cita:
Iniciado por JuanRAPerez
yeap
la idea báse es
creas conexión
creas el rs
haces tu sql
abres el rs
imprimes registros
haces otra sql
abres el rs con esa otra sql
imprimes registros
cierras rs
cierrras coenxion
suerte
Creo que te refererias a esto, pero me falla la última consulta
Código asp:
Ver original<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=xxxxxxxxxx;UID=xxxxxxx;PWD=xxxx;DATABASE=incidencias"
'This code block will create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM NSG_COMENTARIS_INCIDENCIES WHERE (creat_per = '12571') AND (YEAR(data) LIKE '2009') AND (DAY(data) LIKE '9') AND (MONTH(data) LIKE '12')"
rs.open SQL, conn
'will iterate to display the records got from the database
response.write("<table class='left'>")
'response.write("<thead>" & "<th>" & "ID_Comentari" & "</th>" & "<th>" & "ID_Incidencia" & "</th>" & "<th>" & "Data" & "</th>" & "<th>" & "Descripcio" & "</th>" & "<th>" & "Temps Dedicat" & "</th>" & "<th>" & "Creat Per" & "</th>" & "</thead>")
response.write("<thead>" & "<th>" & "ID_Comentari" & "</th>" & "<th>" & "ID_Incidencia" & "</th>" & "<th>" & "Data" & "</th>" & "<th>" & "Temps Dedicat" & "</th>" & "<th>" & "Creat Per" & "</th>" & "</thead>")
While Not rs.EOF
response.write("<tr>")
'response.write("<td>" & rs("id_comentari") & "</td>" & "<td>" & rs("id_incidencia") & "</td>" & "<td>" & rs("data") & "</td>" & "<td>" & rs("descripcio") & "</td>" & "<td>" & rs("temps_dedicat") & "</td>" & "<td>" & rs("creat_per") & "</td>")
response.write("<td>" & rs("id_comentari") & "</td>" & "<td>" & rs("id_incidencia") & "</td>" & "<td>" & rs("data") & "</td>" & "<td>" & rs("temps_dedicat") & "</td>" & "<td>" & rs("creat_per") & "</td>")
response.write("</tr>")
rs.MoveNext
Wend
response.write("</table>")
'closes the connection
'rs.close
'conn.close
'Set rs = Nothing
'Set conn = Nothing
'imprimo usuarios con sus tiempos
'Set conn = Server.CreateObject("ADODB.Connection")
'conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=sqlvs1.datacenter.nexica.com;UID=pectra_tiempos;PWD=jupiter;DATABASE=Nsg_Enric"
'Set rs = Server.CreateObject("ADODB.Recordset")
'rs.open SQL, conn
SQL = "SELECT SUM(temps_dedicat) AS tiempos FROM NSG_COMENTARIS_INCIDENCIES WHERE (creat_per = '12571') AND (YEAR(data) LIKE '2009') AND (DAY(data) LIKE '9') AND (MONTH(data) LIKE '12')"
rs.open SQL, conn
'will iterate to display the records got from the database
response.write("<table class='right'>")
response.write("<thead>" & "<th>" & "Trabajador" & "</th>" & "<th>" & "Tiempo en Min." & "</th>" & "</thead>")
While Not rs.EOF
response.write("<tr>")
response.write("<td>" & "Dani" & "</td>" & "<td>" & rs("tiempos") & "</td>")
response.write("</tr>")
rs.MoveNext
Wend
response.write("</table>")
'closes the connection
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
%
>
ADODB.Recordset error '800a0e79'
Operation is not allowed when the object is open.
/script.asp, line 115
Esa linea esta de la segunda consulta, corresponde a las linea 39 del script del post
rs.open SQL, conn
Muchas gracias de antemano!