Visualizzazione dei risultati da 1 a 8 su 8

Discussione: Problema RS.Close

  1. #1
    Utente di HTML.it L'avatar di Freedom
    Registrato dal
    Jan 2003
    Messaggi
    839

    Problema RS.Close

    Ragazzi...

    non riesco proprio a capire cosa non vada qui:

    codice:
    <%
    Set ObjRS2 = Server.CreateObject("ADODB.Recordset")
    StrSQL2 = "SELECT * FROM DatiUtenti WHERE IdUtente = "&IdUtente
    						
    ObjRS2.Open StrSQL2, ObjConn, 3, 3
    					
    If Not ObjRS2.EOF Then			
       Response.Write("Aperto da: "&ObjRS2("NomeUtente")&"
    ")
       Response.Write(""&FUNConvertiIdNazione(ObjRS2("IdNazione"))&"")
    Else
       response.Write("errr")
    End If
    
    ObjRS2.Close 
    Set ObjRS2 = Nothing
    %>
    Mi esce l'errore:
    Tipo di errore:
    Errore di run-time di Microsoft VBScript (0x800A01A8)
    Necessario oggetto
    /web/visualizza.asp, line 143

    la linea 143 è: ObjRS2.Close
    Sicut Nox Silentes

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Tutto lì lo script?

    Roby

  3. #3
    Utente di HTML.it L'avatar di Freedom
    Registrato dal
    Jan 2003
    Messaggi
    839
    Originariamente inviato da Roby_72
    Tutto lì lo script?

    Roby
    Ciao Roby!

    Bè no... ma l'errore deve perforza essere quì, perchè se tolgo questo blocco tutto il resto si vede correttamente.
    Sicut Nox Silentes

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Secondo me distruggi l'oggetto in qualche parte del codice che non hai mostrato...

    Roby

  5. #5
    Utente di HTML.it L'avatar di Freedom
    Registrato dal
    Jan 2003
    Messaggi
    839
    Questo è il codice completo:

    codice:
    <%@ LANGUAGE="VBSCRIPT" %>
    <% Option Explicit %>
    <% Response.Buffer=true %>
    <% Server.ScriptTimeout = 300 %>
    
    
    
    <title></title>
    <style type="text/css">
    	@import url("/css/style.css");
    </style>
    </head>
    
    <body onload=InitializeNavigation();>
    <div id="container">
    <div id="container2">
    	
        <div id="header"></div>
    	
    	
    	<hr />
    
    	
    	<div id="nav"></div>
    	
    	
    	
    	<div id="extra"></div>
    	
    
    <div id="content">
    
    
    
    
    
    
    
    
    </p>
    	<h1>...</h1>
    	<h2></h2>
    
    
    </p>
    
    
    
    	
    
    		<%	
    		  	'================================================================================
    			'================================ CONTENUTO =====================================
    			'================================================================================
    		%>
    
    <%
    Dim IdUtente 
    %>
    <% Call SUBConnOpen("utenti.mdb") %>
    
    <%
    
    Dim iPageCurrent, reccount, iPageCount, iRecordsShown, da_pag, fino_a_pag, i, cont
    
    Const iPageSize = 12 'NUMERO RECORD PER PAGINA
    Const iPageColumns = 4 'NUMERO DI COLONNE PER RIGA
    
    If Request.QueryString("page") = "" Then
    	iPageCurrent = 1
    Else
    	iPageCurrent = CInt(Request.QueryString("page"))
    End If
    %>
    <table align="center" width="100%" class="Tabella">
    <tr>
    <%
    StrSQL1 = "SELECT * FROM TabA WHERE Stato = 1 ORDER BY DataCreazione ASC;"
    
    Set ObjRS1 = Server.CreateObject("ADODB.Recordset")
    	ObjRS1.PageSize = iPageSize
    	ObjRS1.CacheSize = iPageSize
    	ObjRS1.Open StrSQL1, ObjConn, 3, 1, &H0001 'adOpenStatic, adLockReadOnly, adCmdText
    
    	reccount = ObjRS1.RecordCount
    	iPageCount = ObjRS1.PageCount
    
    	If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    	If iPageCurrent < 1 Then iPageCurrent = 1
    
    If iPageCount = 0 Then
    	SUBErrori(Err_CatVuote)
    Else
    	ObjRS1.AbsolutePage = iPageCurrent
    	iRecordsShown = 0
    	Cont = 1
    
    		
    	Do While iRecordsShown < iPageSize And Not ObjRS1.EOF
    		IdUtente = ObjRS1("IdUtenteCreatore")
    		
    			If (((Cont - 1) Mod iPageColumns = 0) AND Cont <> 1) Then Response.Write("</tr><tr valign=""top"">")
    	%>
    			<td>
    				<table width="100%" align="center" class="Tabella">
    					<tr>
    						<td>
    						"><%=ObjRS1("Nome")%>
    						</td>
    					</tr>
    					<tr><td align="center">
    						<%
    						Set ObjRS2 = Server.CreateObject("ADODB.Recordset")
    						StrSQL2 = "SELECT * FROM DatiUtenti WHERE IdUtente = "&IdUtente
    						
    						'response.Write(strsql1)
    						'response.End()
    						ObjRS2.Open StrSQL2, ObjConn, 3, 3
    					
    						If Not ObjRS2.EOF Then			
    							Response.Write("Aperto da: "&ObjRS2("NomeUtente")&"
    ")
    							Response.Write(""&FUNConvertiIdNazione(ObjRS2("IdNazione"))&"")
    						Else
    							response.Write("errr")
    						End If
    						ObjRS2.Close
    						Set ObjRS2 = Nothing
    						%>
    					</td></tr>
    				</table>
    			</td>
    				<%
    				Cont = Cont + 1
    			iRecordsShown = iRecordsShown + 1
    		
    	ObjRS1.MoveNext
    	Loop
    End If
    		
    		
    ObjRS1.Close
    Set ObjRS1 = Nothing
    Call SUBConnClose()
    %>
    </tr>
    </table>
    
    
    		<% '====================VISUALIZZA PAGINE ===================== %>
    		
    
    </p>
    		<table width="100%" align="center">
    		<tr>
    			<td align="center">Pag. <%=iPageCurrent%> <%= Paginazione_di %>  <%=iPageCount%></font></td>
    		</tr>
    		<tr>
    			<td align="center" valign="middle">
    				<%If iPageCurrent-2 > 0 And iPageCurrent > 2 Then%>
    					">[img]/images/layout/prima.gif[/img]" border="0"> 
    				<%End If%>
    				<%If iPageCurrent > 1 Then%>
    					">[img]/images/layout/precedente.gif[/img]" border="0"> 
    				<%End If%>
    				<%If iPageCount > 2 Then
    					If iPageCurrent-2 < 1 Then da_pag = 1 Else da_pag = iPageCurrent-2
    					If iPageCurrent+2 > iPageCount Then fino_a_pag = iPageCount Else fino_a_pag = iPageCurrent+2
    					Else da_pag = 1
    						fino_a_pag = iPageCount
    					End If%>
    					<%For i = da_pag To fino_a_pag%>
    						<%If i = iPageCurrent Then%>
    							<font color="red"><%=i%></font>
    						<%Else %>	
    							" title="Pag. <%=i%>"><%=i%>
    						<%End If%>	
    					<%Next%>
    					<%If iPageCurrent > 0 And iPageCurrent < iPageCount Then%>
    						 ">[img]/images/layout/successiva.gif[/img]" border="0" > 
    					<%End If%>	
    					<%If iPageCurrent+1 < iPageCount Then%>
    						 ">[img]/images/layout/ultima.gif[/img]" border="0"> 
    					<%End If%></font>
    				</td>
    		</tr>
    		</table>
    	
    			
    		<%	
    		 	'================================================================================
    			'============================= FINE CONTENUTO ===================================
    			'================================================================================
    		%>
    		  
    
    </div>
    <div id="footer"></div>
    
    </div>
    </div>
    </body>
    </html>
    Sicut Nox Silentes

  6. #6
    Utente di HTML.it L'avatar di Freedom
    Registrato dal
    Jan 2003
    Messaggi
    839
    Nessuno c'ha capito niente, vero?
    Sicut Nox Silentes

  7. #7
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Lo script sembra corretto.
    Procedi eliminando parti di pagina, partendo dal basso.
    In modo da avere alla fine solo il loop generale ed il recordset incriminato al suo interno.

    Roby

  8. #8
    Utente di HTML.it L'avatar di Freedom
    Registrato dal
    Jan 2003
    Messaggi
    839
    Originariamente inviato da Roby_72
    Lo script sembra corretto.
    Procedi eliminando parti di pagina, partendo dal basso.
    In modo da avere alla fine solo il loop generale ed il recordset incriminato al suo interno.

    Roby
    Ciao Roby,

    come ti dicevo in precedenza ho già provato ad eliminare parti... il problema risiede in quell'estrazione.
    Sicut Nox Silentes

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.