ASP - Por qué hace esto on error resume next?

 
Vista:

Por qué hace esto on error resume next?

Publicado por Xavi Real (18 intervenciones) el 18/02/2005 08:04:47
En una página ASP tengo la linea 'on error resume next' al principio de todo, para que me deje pasar los errores, pero lo que me hace es quedarse pensando sin dar respuesta. Lo más grave es que me bloquea el servidor donde tengo IIS5 y debo reiniciarlo cada vez.

El error que me da sin el 'on error resume next' lo tengo claro, y es que no encuentra la tabla. Por ello quiero capturar ese error con un IF, pero no llega a ejecyutarse puesto que se queda colgado.

<%
on error resume next
Set Conn = Server.CreateObject("ADODB.Connection")
StrConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("intervalos_2005.mdb")
Set oConn = Server.CreateObject("ADODB.Connection")
oCOnn.Open StrConn
sSQL="Select * From "&a3&" Order By orden,hora_real1"
set RS = oConn.Execute(sSQL)
.... %>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Por qué hace esto on error resume next?

Publicado por felipe largacha (23 intervenciones) el 20/02/2005 22:02:12
hay te mando un codigo correcto de manejo de errores en asp hay otra manera que es con asperror

On Error Resume Next

p_userid = Request(\"p_name\")
p_pass1 = Request(\"p_pass1\")
p_pass2 = Request(\"p_pass2\")
p_first = Request(\"p_first\")
p_last = Request(\"p_last\")
p_email = Request(\"p_email\")

if p_pass1 = p_pass2 then

set outpostDB = server.createObject(\"ADODB.Connection\")
outpostDB.open \"outpost\"

theSQL = \"insert into members \"
theSQL = theSQL & \"(username, password, first_name, last_name, \"
theSQL = theSQL & \"email, believes_in_aliens)\"
theSQL = theSQL & \" values (\'\"&p_userid&\"\', \'\"&p_pass1&\"\', \'\"
theSQL = theSQL & p_first&\"\', \'\"&p_last&\"\', \'\"&p_email&\"\', \'\"
theSQL = theSQL & p_believes_in_aliens&\"\')\"

outpostDB.Execute(theSQL)

for each p_medium in Request(\"p_medium\")
theSQL = \"insert into userid_medium (userid, medium) values (\'\"
theSQL = theSQL & p_userid&\"\', \'\"&p_medium&\"\')\"
outpostDB.Execute(theSQL)
next

outpostDB.close
set outpostDB = Nothing
%>

<% if Err.number = 0 then

\'All is well with the world %>

<H2>User Registration</H2>
Thank you for registering with Primary Outpost!

<% else %>

\'There was a problem with their registration

<H2>Problem</H2>
There was a problem with your registration.
Please go back and choose a different username.

<% end if

else
\'p_pass1 doesn\'t match p_pass2
%>
<H2>Password Error</H2>
Both entries for your password must match.
Please try again. Thank you!
<%
end if
%><!--#include virtual=\"/pagebottom.txt\"--></BODY></HTML>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar