Grazie, sei di grande aiuto.
Ho provato così:
codice:
'va tutto bene

else

  UserCode = objRS("id_user")

if IsNull(session("tentativi")) then
     session("tentativi") = 1
   else
     session("tentativi") = session("tentativi") + 1
  end if
  
  if session("tentativi") = 3 then
    SQLUpdate = "UPDATE codici set Locked = true where user = "&UserCode
    response.write SQLUpdate:response.end
    cn.Execute(SQLUpdate)
end if
Il problema è che restituisce:
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.