The code of the original page class is as follows:
'----------------------------------------' Database Page For SQLServer. ' : Robin_zhang (eway365@tom.com) 'Please keep this information, thank you. '---------------------------------------- Class Splitpage
Public curr_page '// Current page number public istart' // Page Start Record Location PUBLIC IEND '// Page End Record PUBLIC CONNTPAGE' // Page PUBLIC CONN '// Database Connection Object PUBLIC PerpageCount' // Each page Recorded number of records PUBLIC CountRecord '// Total number of records PUBLIC TABLENAME' // Table or view name public key '// Primon PUBLIC CONDition' // Query Condition PUBLIC ORDERBY '// Sort Condition PUBLIC SQL_COUNT' / / Ask total record SQL statement public sql_search '// Query SQL statement public split_record' // Get paging record set PUBLIC URL '// Current page URL PUBLIC BAR1' // Turn Page PUBLIC BAR2 '// Top Page PUBLIC SOLITUDE_SQL' Transfer separate SQL statement '// ------------------ Private internal method collection ------------------- ---- 'Get the number of records, total pages, SQL statement, get the current page private sub getCountRecord () if isnull (Solitude_sql) or iSempty (Solitude_SQL) THEN SQL = "SELECT COUNT (" & Key & ") As Totalue from "& Tablename & Condition Else SQL =" SELECT Count (*) As TotalValue from ("& Solitude_SQL &") Temptablea "End IF
'Response.write "
'Calculated on the current page number and each page displayed End Position Private Sub Count_iend () IEND = ClNG (iStart PerpageCount) if Iend> Clng (CountRecord) THEND = Clng (CountRecord) End Sub Private Function Get_Record () IF Isnull (Solitude_SQL) or iSempty (SOLITUDE_SQL) THEN SQL = "Select * from" & Tablename & "WHERE" & Key & "&" & "&" & "&" & "&" & "&" & TABLENAME & CONDition & Orderby ") and" & key & "in (Select Top" & Ind & "& Key &" & TableName & Condition & Orderby & ")" & Orderby Else SQL = "SELECT * FROM (" & Solitude_SQL & ") A WHERE "& key &" NOT IN ("& Solitude_SQL &") B "& SOLITUDE_SQL &") and "& Key &" in (SELECT TOP " & Ind & "& Key &") C "& SOLITUDE_SQL &") C "& condition & orderby &") "& orderrby endiff" response.write SQL
sql_search = sql set get_record = conn.execute (sql) end function private sub get_url () url = Request.ServerVariables ( "url") & "?" & Request.ServerVariables ( "query_string") pos = InStrRev (url, "& page ") -1 if POS> 0 THEN URL = MID (URL, 1, POS) end if if Request.serverVariables (" query_string ") =" "" "") & "? 1 = 1 "End if End Sub Private Function GET_BAR_GB2312 () BAR1 =" Current "& CURR_PAGE &" page A total of "& CountRecord &" Page "A1 =" Home " a2 = " Next page "a4 =" "" then curr_page = clng (o) else curr_page = 1 end if end sub public sub execute () call getCountRecord () call count_istart () call count_iend () call get_url () set split_record = get_record ( ) CALL GET_BAR_GB2312 () End Sub
End class script> In the previous statement, there is a Not in and an Inselect * from Table_Name WHERE ID NOT IN (SELECT TOP 100 ID "and ID in (SELECT TOP 200 id from table_name Order by ID Desc ) Order by ID DESC test IN will pass through the entire table. So do the following modifications ... SELECT TOP 10 * from table_name where id> (SELECT TOP (SELECT TOP (Page-1) * 10) ID From table_name order by id) as table_temp) Order by ID