Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- DS718+
- utf-8
- FileSystemObject
- ASP
- 따라다니는 배너
- 크로스 컴파일
- jquery 레이어
- 무선랜카드
- submit
- disabled
- javascript
- XMLHTTP
- SQL Injection
- AC1300
- Injection
- synology
- println
- 커널
- PHP GCM
- form
- lsusb
- readonly
- include
- jQuery
- ajax
- RTL88x2BU
- replace
- 시놀로지
- euc-kr
- Getrows
Archives
- Today
- Total
아는 것이 좋은 것이다.
[ASP] Getrows 페이지 이동, 페이징(2차원 배열) 본문
<!-- #include virtual="db커넥션 인클루드" --> <!-- 레코드셋이 많을 경우 혹은 DB접근이 많을시엔 속도저하 문제가 올수 있다. DB접근을 한번만 하여서 DB부하를 최소한으로 줄이고 성능저하를 어느정도 억제할수 있다. 자세한 내용은 검색을 하면 자세히 나옵니다. --> <html> <head> <title>테스트 페이지입니다.</title> </head> <script LANGUAGE="JavaScript"> <!-- function paging(page) { url="?page=" + page; window.open(url,"_self"); } --> </script> <body> <% intPageSize = 15 ' 한페이지에서 보여질 수 intBlockPage = 5 '페이지 구분 수 (이전 X개, 다음 X개) intNowPage = request("page")' 현재페이지 if Len(Trim(intNowPage)) = 0 Then '현재페이지 기본값 intNowPage=1 end if sql = "SELECT count(*),CEILING(CAST(Count(*) AS FLOAT)/" & intPageSize & ") FROM item" Set rs = dbconn.Execute(sql) intTotalCount = rs(0) ' 전체 자료 수 intTotalPage = rs(1) rs.close Set rs = nothing Set rs = Server.CreateObject("ADODB.Recordset") sql = "SELECT TOP " & intNowPage * intPageSize & " * FROM item" rs.open sql,dbconn If Not rs.eof then arrRS = rs.getrows() rs.close set rs = Nothing dbconn.close set dbconn= nothing %> <table width="100%" border="1" cellpadding="3" cellspacing="1"> <tr> <td width="10%" align="center">번 호</td> <td width="75%" align="center">이 름</td> <td width="15%" align="center">브랜드</td> </tr> <% If IsArray(arrRS) Then s_cnt = (intNowPage-1)*intPageSize e_cnt = s_cnt+intPageSize-1 if e_cnt>intTotalCount then e_cnt = intTotalCount-1 end if for i = s_cnt to e_cnt %> <tr> <td align="center"><%=arrRS(0,i)%></td> <td><%=arrRS(1,i)%></td> <td><%=arrRS(2,i)%></td> </tr> <% Next Else %> <tr align="center"> <td colspan="3">데이터가 없습니다.</td> </tr> <% End If %> </table> <table border="0" width="100%"> <!-- 셀렉트 박스를 이용한 페이지 이동 --> <!-- <tr> <td>총자료건수 : <%=intTotalCount%> </td> <td align="right"> 현재페이지 : <select name="selectpage" onChange="paging(this.options[this.selectedIndex].value,0)"> <% If IsArray(arrRS) Then for i = 1 to intTotalPage if i = CLng(intNowPage) then %> <option selected value="<%=i%>"><%=i%></option> <% else %> <option value="<%=i%>"><%=i%></option> <% end if Next Else %> <option value="">없음</option> <% End if %> </select> <font size="3"><b>/<%=intTotalPage%> page</b></font> </td> </tr> --> <tr> <td valign="middle" width="100%" align="center" colspan="2"> <% intTemp = Int((intNowPage - 1) / intBlockPage) * intBlockPage+ 1 Response.Write "<a href=""?page=1"" OnFocus='this.blur();' style='text-decoration:none;'>처음</a> " If intTemp = 1 Then Response.Write "◁ " Else Response.Write "<a href=""?page=" & intTemp - intBlockPage & """ OnFocus='this.blur();' style='text-decoration:none;'>◀</a> " End If intLoop = 1 Do Until intLoop > intBlockPage Or intTemp > intTotalPage If intTemp = CInt(intNowPage) Then Response.Write "<font style='font-weight:bold; color:#ee6666;'> [" & intTemp & "] </font> " Else Response.Write"<a href=""?page=" & intTemp & """ OnFocus='this.blur();' style='text-decoration:none;'> [" & intTemp & "] </a> " End If intTemp = intTemp + 1 intLoop = intLoop + 1 Loop If intTemp > intTotalPage Then Response.Write "▷ " Else Response.Write"<a href=""?page=" & intTemp & """ OnFocus='this.blur();' style='text-decoration:none;'>▶</a> " End If Response.Write "<a href=""?page=" & intTotalPage & """ OnFocus='this.blur();' style='text-decoration:none;'>끝</a>" %> </td> </tr> </table> </body> </html>
'ASP' 카테고리의 다른 글
[ASP] xml 데이터를 특정URL로 전송, 결과값 받기 (0) | 2014.05.10 |
---|---|
[ASP] form request 배열(같은 name 변수 표현) (0) | 2014.05.07 |
[ASP] 한글 깨짐 변환 (1) | 2014.04.30 |
[ASP] 다운로드 페이지 프로그램 (0) | 2014.04.30 |
[ASP] 달력 생성 소스 (공휴일 추가가능) (0) | 2014.04.27 |
Comments