페이징 코드의 예
<%''이 프로그램의 파일 이름은 pages.asp%>입니다
<%'' '는 "/programfiles/commonfiles/system/ado"directory에서 복사 할 수있는 Ado Constant 테이블 파일 Adovbs.inc가 포함되어 있습니다.
<!-#includefile = "adovbs.inc"->
<%''* 데이터베이스 연결 설정, 다음은 Oracle8.05 데이터베이스입니다.
setconn = server.createobject ( "adodb.connection")
conn.open "제공자 = msdaora.1; dataSource = yoursrcName; userId = yourUserId; password = yourpassword;"
setrs = server.createObject ( "adodb.recordset") ''레코드 세트 개체를 작성하십시오
rs.cursorlocation = headeclient ''설정 레코드 세트 포인터 속성
``* 한 페이지 내에서 총 레코드 수를 설정하고 필요에 따라 조정할 수 있습니다.
Rs.Pagesize = 10
''* 쿼리 명령문을 설정합니다
strsql = "selectId, 이름, 주소, 주소 서적 OrderById의 전화"
Rs.OpenStrSQL, Conn, AbodeNstatic, Adlockreadonly, adcmdtext
%>
<html>
<헤드>
<title> 페이징 예 </title>
<scriptLanguage = javaScript>
// "[첫 페이지]"를 클릭 할 때 응답 :
functionpagefirst ()
{
document.myform.currentPage.SelectedIndex = 0;
document.myform.currentpage.onchange ();
}
// "[이전 페이지]"를 클릭 할 때 응답 :
functionpageprior ()
{
document.myform.currentPage.SelectedIndex-;
document.myform.currentpage.onchange ();
}
// "[다음 페이지]"를 클릭 할 때 응답 :
functionpagenext ()
{
document.myform.currentPage.SelectedIndex ++;
document.myform.currentpage.onchange ();
}
// "[마지막 페이지]"를 클릭 할 때 응답 :
functionpagelast ()
{
document.myform.currentPage.SelectedIndex = document.myform.currentPage.length-1;
document.myform.currentpage.onchange ();
}
// "페이지"를 선택할 때 응답 : :
functionpagecurrent ()
{//pages.asp는이 프로그램의 파일 이름입니다
document.myform.action = 'pages.asp? page ='+(document.myform.currentPage.SelectedIndex+1)
document.myform.submit ();
}
</스크립트>
</head>
<bodybgcolor = "#ffffcc"link = "#008000"vlink = "#008000"link = "#ff0000" ">
<%ifrs.eofthen
response.write ( "<fontsize = 2color =#000080> [데이터베이스의 레코드가 없음!] </font>")
또 다른
''현재 페이지 번호를 지정하십시오
ifrequest ( "currentpage") = ""그런 다음
rs.AbsolutePage = 1
또 다른
rs.absolutepage = clng (요청 ( "currentpage"))
endif
``myform 형식을 만들고 메소드가 얻습니다
response.write ( "<formmethod = getName = myform>")
response.write ( "<palign = center> <fontsize = 2color =#008000>")
``페이지 설정 하이퍼 링크 회전
ifrs.pagecount = 1then
response.write ( "[첫 페이지] [이전 페이지] [다음 페이지] [마지막 페이지]")
또 다른
ifrs.absolutepage = 1then
response.write ( "[첫 페이지] [이전 페이지]")