디렉토리 목록 얻어오기 예제

 

[결과 화면]
[실제 파일 목록]

 

코드

<%
	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>

 

+ Recent posts