Aiutatemi sono disperato!!

Non riesco a far completare gli ordini sul mio sito.
I dati vengono passati correttamente a paypal e mi ritornano anche giusti ma non c'è verso di fargli scrivere nel database (un mdb). Nella cronologia IPN dell'account Paypal mi dà sempre "Codice risposta HTTP 500" e "tentativo in corso". Tramite degli oggetti mail vedo che Paypal cerca di eseguire la pagina più volte ma il database non viene proprio toccato!!!

Vi allego la pagina ASP. Se vi serve sapere il mio sito è hostato su Aruba.

Grazie mille a tutti!!!!

P.S. Non mi rimproverate per il mio codice molto incasinato, sto imparando ancora

codice:
<%@LANGUAGE="VBScript"%>
<%

FUNCTION fixQuotes( theString )
  fixQuotes = REPLACE( theString, "'", "''" )
END FUNCTION

					'############ Incremento contatore degli ordini

sub counter()

Set conn = Server.CreateObject("ADODB.Connection")
conn.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=" + server.mappath("../mdb-database/storeDB.mdb")
conn.Open


Set orderRS = Server.CreateObject("ADODB.Recordset")
	orderRS.ActiveConnection = conn

   sqlString = "SELECT * FROM counterorder WHERE ID=1"
   orderRS.Open sqlString
   strSessione = orderRS("counter_ID")
   strSessione = strSessione + 1
   orderRS("counter_ID") =  strSessione 

Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "strSessione " & strSessione
mail.HTMLBody = " "
mail.Send
Set mail = Nothing
   
   orderRS.Update
   orderRS.Close 
   conn.Close
   
Set orderRS = Nothing
Set conn = Nothing
   
end sub

'######################################################################################################################

                  '############# Inserisco l'ordine nella relativa tabella

sub registra_ordine()

Set conn1 = Server.CreateObject("ADODB.Connection")
conn1.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=" + server.mappath("../mdb-database/storeDB.mdb")
conn1.Open


Set orderRS1 = Server.CreateObject("ADODB.Recordset")
	orderRS1.ActiveConnection = conn1

sqlString1 = "INSERT INTO orders (" &_
  "order_id, " &_
  "order_productID, " &_
  "order_price, " &_
  "order_priceless, " &_
  "order_quantity, " &_
  "order_userID, " &_
  "order_entrydate, " &_
  "order_status " &_
  ") SELECT " &_
  "cart_id, " &_
  "cart_productID, " &_
  "cart_price, " &_
  "cart_priceless, " &_
  "cart_quantity, " &_
  "cart_userID, " &_
  "NOW(), " &_
  "0 " &_
  "FROM cart WHERE " &_
  "cart_userID =" & userID
	
Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "sqlString1 " & sqlString1
mail.HTMLBody = " "
mail.Send
Set mail = Nothing

    conn1.Execute sqlString1
                    
sqlString2 = "UPDATE Orders  SET " &_
   "order_ragsoc='"& fixQuotes(RagSoc) & "',"  &_
   "order_various='" & tipopagamento & "', " &_
   "order_session= "& strSessione & " WHERE " &_
   "order_userID="& userID & " AND order_session ='vuoto'" 

Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "sqlString2 " & sqlString2
mail.HTMLBody = " "
mail.Send
Set mail = Nothing

    conn1.Execute sqlString2
	
   orderRS1.Close 
   conn1.Close
   
Set orderRS1 = Nothing
Set conn1 = Nothing
			
end sub

'######################################################################################################################
                  

                  '############# Svuoto tabella carrello
				  
sub svuota_carrello()

Set conn2 = Server.CreateObject("ADODB.Connection")
conn2.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " & "Data Source=" + server.mappath("../mdb-database/storeDB.mdb")
conn2.Open


Set orderRS2 = Server.CreateObject("ADODB.Recordset")
	orderRS2.ActiveConnection = conn2




sqlString3 = "DELETE FROM cart WHERE cart_userID=" & userID

Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "sqlString3 " & sqlString3
mail.HTMLBody = " "
mail.Send
Set mail = Nothing

conn.Execute sqlString3

   orderRS2.Close 
   conn2.Close
   
Set orderRS2 = Nothing
Set conn2 = Nothing

end sub

'######################################################################################################################


Dim Item_number, Payment_status, Payment_amount, userID, Prov, tipopagamento, con, sqlString
Dim Txn_id, Receiver_email, Payer_email, CAP, City, RagSoc, Via, strSessione, data, emailSECRE, email2
Dim objHttp, str, HTML


' read post from PayPal system and add 'cmd'
str = Request.Form & "&cmd=_notify-validate"

' post back to PayPal system to validate
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
' set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.open "POST", "https://www.paypal.com/cgi-bin/webscr", false
objHttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
objHttp.Send str

' assign posted variables to local variables
RagSoc = Request.Form("item_name")
Item_number = Request.Form("item_number")
Payment_status = Request.Form("payment_status")
Payment_amount = Request.Form("mc_gross")
Payment_currency = Request.Form("mc_currency")
Txn_id = Request.Form("txn_id")
Receiver_email = Request.Form("receiver_email")
Payer_email = Request.Form("payer_email")
CAP = Request.Form("address_zip")
City = Request.Form("address_city")
userID = Request.Form("custom")
Via = Request.Form("address_street")
Prov = Request.Form("address_state")
data= Request.Form("payment_date")
tipopagamento = "Paypal"
				

' Check notification validation
if (objHttp.status <> 200 ) then

Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "Errore Paypal su ordine numero " & strSessione
mail.HTMLBody = "Errore " & objHttp.status
mail.Send
Set mail = Nothing

elseif (objHttp.responseText = "VERIFIED") then

Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "Ordine Paypal numero " & strSessione
mail.HTMLBody = "Payment_status " & Payment_status & "
Receiver_email " & Receiver_email & "
Payment_currency " & Payment_currency & "
UserID " & userID
mail.Send
Set mail = Nothing

       ' check that Payment_status=Completed
       if Payment_status = "Completed" then
		   counter()
           if Receiver_email = "francoiannelli@secretel.eu" then
           ' check that Receiver_email is your Primary PayPal email
				registra_ordine()
                if Payment_currency = "EUR" then           
                 ' check that Txn_id has not been previously processed           
                 ' check that Payment_amount/Payment_currency are correct
                 ' process payment  
					svuotacarrello()
					if (userID <> "meeting_room") then               
                 
						
						
						'inviomail()
						
					end if
				end if
			end if
		end if
elseif (objHttp.responseText = "INVALID") then
' log for manual investigation

'if POST from PayPal is INVALID, send email using CDONTS

Set mail = CreateObject("CDO.Message")
mail.From = "webmaster@secretel.it"
mail.To = "webmaster@secretel.it"
mail.Subject = "INVALID IPN"
mail.HTMLBody = str & " " & objHttp.responseText & " " & strSessione
mail.Send
Set mail = Nothing

else
' error
Set objHttp = Nothing
end if
%>