关于 on error resume next.请指点。
myhon 2003-08-03 11:34:00 关于 on error resume next.
举个例子:
1.
<%
on error resume next
sqlStr="insert into users(uerID) values('" & userId & "')"
'userId 是关键字,执行前不检测userId 是否已存在,。
conn.execute(sqlStr)
if conn.errors.count>0 then
response.write "insert error!"
response.end
end if
%>
===========================================
2.
<%
sqlStr="select userId from users where userId='" & userId & "'"
set rs=conn.execute(sqlStr)
if not(rs.eof and rs.bof) then
response.write "insert error!"
response.end
else
sqlStr="insert into users(uerID) values('" & userId & "')"
conn.execute(sqlStr)
end if
%>
1和2 用那种好呢?