제목 : (3)출력 리스트(BoardList.asp)
<%
'--------------------------------------------------
' Title : Basic 보드
' Program Name : boardlist.asp
' Program Description : 글 리스트 페이지
' Include Files : None
' Copyright (C) 2004 Park Yong Jun
' E-mail: redplus@redplus.net
' Support: http://www.dotnetkorea.com/
'--------------------------------------------------
%>
<%
'[1] 변수 선언
Option Explicit
Dim objCon: Dim objRs: Dim strSql
'[2] 인스턴스 생성
Set objCon = Server.CreateObject("ADODB.Connection")
'[3] 오픈
objCon.Open("Provider=SQLOLEDB.1;Password=Basic;Persist Security Info=True;User ID=Basic;Initial Catalog=Basic;Data Source=(local)")
'[4] 레코드셋 객체의 인스턴스 생성
Set objRs = Server.CreateObject("ADODB.RecordSet")
'[5] 명령어 실행
strSql = "Select * From Basic Order By Num Desc"
objRs.Open strSql, objCon
'[6] 출력
If objRs.BOF Or objRs.EOF Then
Response.Write("데이터가 없습니다.")
Else
Call ShowRecordSet(objRs)
End If
'[7] Close()
objRs.Close(): objCon.Close()
'[8] Nothing
Set objRs = Nothing: Set objCon = Nothing
%>
<%
Sub ShowRecordSet(objRs)
%>
<table border=1 width="100%">
<%
While Not objRs.EOF
%>
<TR onmouseover="this.style.backgroundColor='red';" onmouseout="this.style.backgroundColor='';">
<TD><%=objRs("Num")%></TD>
<TD><a href="./boardview.asp?Num=<%=objRs("Num")%>"><%=objRs("Title")%></a></TD>
<TD><%=objRs("Name")%></TD>
<TD><%=objRs("Email")%></TD>
<TD><%=objRs("ReadCount")%></TD>
</TR>
<%
objRs.MoveNext()
WEnd
%>
<table>
<%
End Sub
%>
<a href="./boardwrite.asp">글쓰기</a>