디렉토리 목록 얻어오기 예제
[결과 화면] |
[실제 파일 목록] |
코드
<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set folderObj = fs.GetFolder(Server.MapPath("."))
Set files = folderObj.Files
%>
<html>
<head>
<title> 파일 리스트 얻기 예제 </title>
</head>
<body>
<h3><%=Server.MapPath(".")%> 디렉토리 목록 </h3>
<table border="1" width="900" style="font-size:7pt;" cellpadding="2">
<tr>
<th>이름</th>
<th>크기</th>
<th>형식</th>
<th>생성 시각</th>
<th>마지막 엑세스 시간</th>
<th>마지막 수정 시간</th>
</tr>
<%For Each file in files%>
<tr>
<td><a href=" <%=file.name%>"><%=file.name%></a></td>
<td><%=file.size%> byte</td>
<td><%=file.type%></td>
<td><%=file.DateCreated%></td>
<td><%=file.DateLastAccessed%></td>
<td><%=file.DateLastModified%></td>
</tr>
<%Next%>
</table>
</body>
</html>
DB값 테이블로 출력하기
[출력 화면] | [DB 쿼리문 출력 결과] |
코드
-- DB연결 해주기
<html>
<head>
<title>예제 - DB값 테이블 형태로 출력하기</title>
</head>
<body>
<table border="1" width="400" style="font-size:7pt;" cellpadding="2">
<tr>
<th>SEQ</th>
<th>NAME</th>
<th>CONTENTS</th>
<th>REGDATE</th>
</tr>
<%Do While Not OraRec.EOF%>
<tr>
<td><%=OraRec.Fields("seq")%></td>
<td><%=OraRec.Fields("name")%></td>
<td><%=OraRec.Fields("contents")%></td>
<td><%=OraRec.Fields("regdate")%></td>
</tr>
<%OraRec.MoveNext%>
<%Loop%>
</table>
</body>
</html>
'프로그램 > ASP' 카테고리의 다른 글
[ASP] 게시판 만들기 2 - 글 목록 페이지 (0) | 2021.04.13 |
---|---|
[ASP] 게시판 만들기 1 - 프로젝트 기획, DB테이블 구성 (0) | 2021.04.02 |
[ASP] DB 예제 : 데이터 여러 개 출력하기 (0) | 2021.03.09 |
[ASP] 문자열 함수, 숫자 함수 실습 (0) | 2021.03.09 |
[ASP] 날짜 및 시간 함수 실습 (0) | 2021.03.09 |