자바스크립트나 PHP 같은 문법에서는 객체를 이리저리 넘겨주는게 되기 때문에 상당히 유용했지만, ASP 에서는 이것에 대해 언급된 글도 없고, 이리저리 해봐도 안되길래 안되는줄 알았다.
그런데, 오늘 테스트 해보니 되었다.
객체 자체를 다른 SUB 나 Function 으로 전달할 수 있다면, 페이지를 좀더 깔끔하게 혹은 지능적으로 처리할 수 있다.
아래는 테스트한 코드이다.
<%
'----------------------------------------------------
sql = "select * from 테이블명 where code='코드값'"
set rs=db.execute(sql)
if rs.eof then
call errmsg_infonone()
else
call infoload(rs)
end if
set rs=nothing
'----------------------------------------------------
%>
<% sub errmsg_infonone %>
<table border="0" width="700" height="245" cellspacing="0" cellpadding="0">
<tr>
<td width="700" height="200" align="center">
정보가 없습니다.
</td>
</tr>
</table>
<% end sub %>
<%
'----------------------------------------------------
sub infoload(rs)
Response.Write rs.fields("code")
end sub
'----------------------------------------------------
%>
덧글