Ciao a tutti,
ho questo codice
codice:
 <%
			Set objConn = Server.CreateObject("ADODB.Connection")

'*************************************
' CHANGE THE FOLLWING DATA SOURCE
' PATH TO POINT TO WHERE YOU HAVE
'*************************************
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/mdb-database/studenti.mdb")
objConn.connectionstring = strCon
objConn.Open
pippo=temp+meseanno
Set objRS = Server.CreateObject("ADODB.Recordset")
'******************CREO RS PER L'INSERIMENTO DELLE DATE*****************'
				' Set the SQL Statement to get the information from the database
				strSQL = "SELECT * FROM lezioni WHERE studente = '" & user & "' AND DATA= '" & pippo & "' AND ORA= '"& orario &"' "
				' Open the Database
				objRS.Open strSQL, objConn
			
			
			
			
				if not objRS.eof THEN%>
          <tr>
			<td height=50 align="center" class="blogEntry1ora"> 18.00 
 <%=objRS("materia")%>
			
			<%ELSE%>
			<tr>
			<td class="blogEntry" height=50>
			<%end if
			objConn.close%>
			</td>
		</tr>
		
		
		
		
		 <%
			Set objConn = Server.CreateObject("ADODB.Connection")

'*************************************
' CHANGE THE FOLLWING DATA SOURCE
' PATH TO POINT TO WHERE YOU HAVE
'*************************************
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/mdb-database/studenti.mdb")
objConn.connectionstring = strCon
objConn.Open
pippo=temp+meseanno
Set objRS = Server.CreateObject("ADODB.Recordset")
'******************CREO RS PER L'INSERIMENTO DELLE DATE*****************'
				' Set the SQL Statement to get the information from the database
				strSQL = "SELECT * FROM lezioni WHERE studente = '" & user & "' AND DATA= '" & pippo & "' AND ORA= '"& orario2 &"' "
				' Open the Database
				objRS.Open strSQL, objConn
			
			
			
			
				if not objRS.eof THEN%>
          <tr>
			<td height=50 align="center" class="blogEntry2ora"> 19.00 
 <%=objRS("materia")%>
			
			<%ELSE%>
			<tr>
			<td class="blogEntry" height=50>
			<%end if
			objConn.close%>
			</td>
		</tr>
		
		
		
		 <%
			Set objConn = Server.CreateObject("ADODB.Connection")

'*************************************
' CHANGE THE FOLLWING DATA SOURCE
' PATH TO POINT TO WHERE YOU HAVE
'*************************************
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/mdb-database/studenti.mdb")
objConn.connectionstring = strCon
objConn.Open
pippo=temp+meseanno
Set objRS = Server.CreateObject("ADODB.Recordset")
'******************CREO RS PER L'INSERIMENTO DELLE DATE*****************'
				' Set the SQL Statement to get the information from the database
				strSQL = "SELECT * FROM lezioni WHERE studente = '" & user & "' AND DATA= '" & pippo & "' AND ORA= '"& orario3 &"' "
				' Open the Database
				objRS.Open strSQL, objConn
			
			
			
			
				if not objRS.eof THEN%>
          <tr>
			<td height=50 align="center" class="blogEntry3ora"> 20.00 
 <%=objRS("materia")%>
			
			<%ELSE%>
			<tr>
			<td class="blogEntry" height=50>
			<%end if
			objConn.close%>
			</td>
		</tr>
Il problema sta nel fatto che questo codice è all'interno di ciclo while di 30 salti.
Se lascio questo codice ottengo apri e chiudi db 90 volte e non mi sembra bello.
Come posso evitare l'apertura e la chiusura continua.
Ho provato a fare un apri objconn all'inizio e un objconn.close alla fine. Ma dopo mi da errore su objRs
Come devo fare?