페이징에 대하여...

Name  
   박동배 ( Hit: 2144 Vote: 9 )
Homepage      http://http://
Category      질문

쫌전 야그한 123페이지 구분 링크까정 만들었는데요.. 다른페이지 링크가 동일한 에러 메세지가 나오구요...

rs.Open SQL,db,3 부분에 숫자(레코드셋 커서타입)을 바꿔주면 조금씩 에러메세지가 틀리거든요? 대체 무어시 문제일까요? 힝~~~~
빨랑 갈켜줘요.. 여기는 코볼프로그래머랑 웹디자이너뿌이 엄써 마땅히 물어볼수도 없네요.... 미르초고수님 아처님 부탁해요... 그럼..

<%

if request("page")="" then
page=1
else
page=request("page")
end if


search = request("search")
SearchString =request("SearchString")

Set db = Server.CreateObject("ADODB.Connection")
db.Open "", "", ""

SQL = "SELECT com_owner, com_name, com_post, com_address, com_tel FROM company"
SQL = SQL & " where " & search & " like '%" & SearchString & "%' "
'ORDER BY com_name DESC"

Set rs = Server.CreateObject("ADODB.Recordset")
rs.PageSize = 10
rs.Open SQL,db,3


%>
<html>

<head>
<title>검색결과</title>
<style type="text/css">
A {text-decoration: none; color:black}
A:hover {text-decoration: underline; color:orange}
</style>
</head>

<body bgcolor="#FFFFFF">
<% if rs.BOF or rs.EOF then %>


<p align="center"> </p>

<p align="center"> </p>

<p align="center"><font face="Arial Rounded MT Bold" size="5" color="#FF8000">No Result !!</font></p>

<p align="center"> </p>

<p align="center"><font face="돋움" size="2"><%=SearchString%></strong> 로 검색을
수행하였지만</font></p>

<p align="center"><font face="돋움" size="2"><font color="#008080">발견된</font> <font color="#008080">검색결과가 없습니다.</font></font></p>

<p align="center"> </p>

<p align="center"><font face="돋움" size="2">< <a href="default.asp">검색 페이지로
돌아가기</a> ></font></p>

<%
else
totalpage = rs.pagecount
rs.absolutepage = page
'rs.MoveLast '총 레코드의 숫자를 알기위해 레코드의 끝을 보낸다.
recordcnt = rs.RecordCount '총 레코드의 갯수를 recordcnt라는 변수에 저장한다.
'rs.MoveFirst '다시 레코드의 위치를 원상태로 돌린다.
%>

<p align="center"><font face="Arial Rounded MT Bold" color="#008080"><big><big><strong>Search
List</strong></big> </big></font></p>
<div align="center">

<p align="center"><font face="돋움" size="2"> <strong><%=SearchString%></strong> (으)로 검색한 결과 <%=recordcnt%>
개의 데이터를 찾았습니다.</font></p>
<div align="center"><center>

<table border="0" cellspacing="2" width="600">
<tr>
<td width="5%" bgcolor="#008080" align="center" height="25"><font face="돋움" size="2" color="#FFFFFF">No.</font></td>
<td width="20%" bgcolor="#008080" align="center" height="25"><font face="돋움" size="2" color="#FFFFFF">업체명</font></td>
<td width="20%" bgcolor="#008080" align="center" height="25"><font face="돋움" size="2" color="#FFFFFF">대표자</font></td>
<td width="40%" bgcolor="#008080" align="center" height="25"><font face="돋움" size="2" color="#FFFFFF">주소</font></td>
<td width="15%" bgcolor="#008080" align="center" height="25"><font face="돋움" size="2" color="#FFFFFF">전화번호</font></td>
</tr>
<% num=1
i = 1
Do until rs.EOF Or i>rs.PageSize%>
<tr>
<td width="5%" align="center" height="25"><font face="돋움" size="2" color="#000000">
<%=num%></font></td>
<td width="20%" align="center" height="25"><font face="돋움" size="2" color="#000000">
<%=rs("com_name")%></a></font></td>
<td width="20%" align="center" height="25"><font face="돋움" size="2" color="#000000">
<%=rs("com_owner")%></font></td>
<td width="40%" align="center" height="25"><font face="돋움" size="2" color="#000000">
<%=rs("com_address")%></a></font></td>
<td width="15%" align="center" height="25"><font face="돋움" size="2" color="#000000">
<%=rs("com_tel")%></font></td>
</tr>
<%
rs.MoveNext
num=num+1
i=i+1
loop
%>
</table>
</center></div></div>


<center><hr width="600"></center>
<center><font face="돋움" size="2" color="#000000">
<% if page <> 1 then%>
< <a href="search_result.asp?page=<%=page-1%>">이전페이지</a> >
<% else %>
< 이전페이지 >
<%end if%>
<font size= 2 color=gray>
<%
blockPage=Int((page-1)/10)*10+1
if blockPage = 1 Then
Response.Write "[이전 10개] ["
Else
%>
<a href="search_result.asp?page=<%=blockPage-10%>">[이전 10개]</a> [
<%
End If
i=1
Do Until i > 10 or blockPage > rs.pagecount
If blockPage=int(page) Then
%>
<%=blockPage%>
<%Else%>
<a href="search_result.asp?page=<%=blockPage%>"><%=blockPage%></a>
<%
End If

blockPage=blockPage+1
i = i + 1
Loop
'************************ 다음 10 개 구문 시작***************************
if blockPage > rs.pagecount Then
Response.Write "] [다음 10개]"
Else
%>
] <a href="search_result.asp?page=<%=blockPage%>">[다음 10개]</a>
<%
End If
'************************ 다음 10 개 구문 끝***************************
%>
</font>
<% if Cint(page) <> Cint(totalpage) then%>
< <a href="search_result.asp?page=<%=page+1%>">다음페이지</a> >
<% else %>
< 다음페이지 >
<% end if%>
         
<%=page%> page / <%=totalpage%> pages

</font>
</center>
<center>


<p align="center"><font face="돋움" size="2">< <a href="default.asp">검색 페이지로
돌아가기</a> ></font></p>
<% end if%>

<%
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
%>
<div align="center"><center>

<form method="POST" action="search_result.asp">
<table border="0" cellspacing="0" width="500">
<tr>

<td><div align="center"><center><p><font color="#004080" face="Century Gothic"><small><strong>Search
      </strong></small></font><select name="search" size="1" style="font-family: 돋움체">


<option value="com_name">업체명</option>
<option value="com_owner">대표자</option>
<option value="com_address">주소</option>
</select>    <input type="text" name="SearchString" size="20" style="border: 1px dashed">    <input type="submit" value=" 검 색 " name="btn" style="background-color: rgb(238,238,238); color: rgb(0,47,94); font-weight: bolder"> </td>
</tr>

</table></form>
</center></div>
</body>
</html>

본문 내용은 8,616일 전의 글로 현재의 관점과 다를 수 있습니다.

Post: https://achor.net/board/qna/36
Trackback: https://achor.net/tb/qna/36

카카오톡 공유 보내기 버튼 LINE it! 밴드공유 Naver Blog Share Button
Please log in first to leave a comment.


Tag


  당신의 추억

ID  

  그날의 추억

Date  

First Written: 02/19/2001 00:45:20
Last Modified: 08/23/2021 11:47:39