% dim v_search, v_keyword, table, Query_Fields, Query_Where, Query_OrderBy Dim recordcount dim pagesize, v_totalpage, v_page, TotalCnt, v_block v_search = inputValue( Request.QueryString("p_search") ) '검색조건 v_keyword = inputValue( Request.QueryString("p_keyword") ) '검색어 prepage = Request.ServerVariables("path_info") & "?" & Request.ServerVariables("query_string") '현재페이지경로 table = "em_tran" '테이블 idx_field = "tran_pr" '기본키 oreder_filed = "tran_date desc" '정렬기준 필드 Query_Fields = "tran_pr, tran_date, tran_msg, tran_phone" '불러올 필드 pagesize = 10 '목록개수 v_block = 10 '페이지개수 '==================조합 쿼리문======================= If v_keyword <> "" then Query_Where = " where tran_status = 1 and tran_id = '" & session("ss_m_id") & "' and tran_rslt is null and tran_date >= convert(datetime, getdate()) and " & v_search & " like '%" & v_keyword & "%'" andOrWhere = " and " Else Query_Where = " where tran_status = 1 and tran_id = '" & session("ss_m_id") & "' and tran_rslt is null and tran_date >= convert(datetime, getdate())" andOrWhere = " and " End if Query_OrderBy = " ORDER BY "&oreder_filed '==================조합 쿼리문======================= '==================전체 레코드 수 뽑기=============== sql="select count("&idx_field&") from " & table & Query_Where set rs = DbCon.execute(sql) recordcount=CInt( rs(0) ) '이 전체레코드갯수를 이용해서 페이지갯수를 뽑아 낼것이다. Set rs = nothing '==================전체 레코드 수 뽑기=============== v_totalpage=fix((recordcount-1)/pagesize)+1 '전체덩어리갯수 v_page = Request.QueryString("p_page") if v_page="" then v_page = 1 elseif cint(v_page) < 1 then v_page = 1 elseif cint(v_page)>cint(v_totalpage) then v_page=cint(v_totalpage) end if '========================리스트 출력 쿼리문 생성====================== 'MS-SQL sql = "select Top " & pagesize& " " & Query_Fields & " from " & table sql = sql & Query_Where & andOrWhere & " "&idx_field&" not in" sql = sql & "(select top " & pagesize * (v_page - 1) & " "&idx_field&" from " & table sql = sql & Query_Where & Query_OrderBy & ")" sql = sql & Query_OrderBy '========================리스트 출력 쿼리문 생성 끝====================== 'response.write sql Set rs = Dbcon.Execute( sql ) If rs.bof Or rs.eof Then List_data = Null TotalCnt = 0 else List_data = rs.getrows TotalCnt = recordcount End if Set rs = Nothing DbCon.close Set DbCon = Nothing %>