your program provides. C + + encapsulation is particularly good (personally feel much better than Java, Java into the jar package can easily be anti-compilation, C + + to anti-compilation is more difficult), I just give you to compile the library and interface of the header file can be.From an example, the realization of the solution needsLet's look at a scene first. Suppose you have an electronic document, a document with multiple pages (page), and a number of text cells under each page (TextU
@ sqlstring
3. in earlier versions without row_number, use a temporary table to store all records that meet the conditions and set auto-increment fields. Then, return the corresponding data based on the input page number. SQL 2000/2005/2008 is applicable.
The disadvantage is that the efficiency is not high, but it is common.
There is a full version:
Alter procedure [DBO]. [lzd_sp_getdocumentlistbysql]@ Ipage int,@ Ipagesize int,@ Searchstri
This is a function on the page, placed in the page.inc, mainly for the data is not very large database, where the HTML format of the function can be changed.
' File name: Page.inc
' Function: function to process data paging
"Author: Heaven and earth are useless"
Sub Showpagebar (Totalpage,curpage,strurl)
' parameter totalpage: entire page
' Parameter curpage: current page
' parameter strURL: The connection address used for paging
DIM strpage
Curpage=getvalidpageno (Totalpage,curpage)
Response.Wr
js| Paging//author tar (bigangell@yesky.com)
You can copy the code in any copy, but please add the above author information
If you have any questions, please contact me.
Effect Please see http://210.77.144.64/kk/java/java/article.jsp
int i;int ipage=10;int allpage;int pages;int cpage=1;int spage;
Java.lang.String Sql,pagesql;Java.sql.ResultSet rs,pagers;
Pagesql = "SELECT count (a_id) as a from article";pagers = Sqlconn.executequery
Response.Write "End SUB
Function Getvalidpageno (Pagecount,curpage)
Dim IPage
Ipage=curpage
IF cInt (curpage) Ipage= 1
End IF
IF cInt (IPage) > CInt (pagecount) THEN
Ipage= PageCount
End IF
Getvalidpageno=ipage
End Function
%>
. createparameter ("@ userid", 3, 1, 4, userid). ExecuteEndIf mycomm (0) = 1 thenUsername = mycomm (1)ElseUsername = "this user does not exist"End ifSet mycomm = nothing
6. Stored Procedures that return both parameters and Record SetsSometimes, we need a stored procedure to return both parameters and record sets. For example, when using Stored Procedure paging, we need to return parameters such as the record set and total data. The following is a stored procedure for paging:
/* SP6 */Create p
When displaying the records in a table, you need to display the records by page because there are many records. Here, the SQL Stored procedure is used to display the records by page.1. For database and field, see conn. asp.Add several records to the table2. Stored Procedure CodeCreate procedure dbo. getUserList@ IPageCount int OUTPUT, -- Total number of pages@ IPage int, -- current page number@ IPageSize int -- number of records per pageAsSet nocount
then
Username = mycomm (1)
Else
Username = "this user does not exist"
End if
Set mycomm = nothing
6. Stored Procedures that return both parameters and Record Sets
Sometimes, we need a stored procedure to return both parameters and record sets. For example, when using Stored Procedure paging, we need to return parameters such as the record set and total data. The following is a stored procedure for paging:
/* SP6 */
Create procedure DBO. getuserlist
@ Ipagecount int output, -- total number of pa
reversed.. Parameters. append. createparameter ("@ username", 40). Parameters. append. createparameter ("@ userid", 3, 1, 4, userid). ExecuteEndIf mycomm (0) = 1 thenUsername = mycomm (1)ElseUsername = "this user does not exist"End ifSet mycomm = nothing6. Stored Procedures that return both parameters and Record Sets
Sometimes, we need a stored procedure to return both parameters and record sets. For example, when using Stored Procedure paging, we need to return both the record set and total
("@ userid", 3, 1, 4, userid). ExecuteEndIf mycomm (0) = 1 thenUsername = mycomm (1)ElseUsername = "this user does not exist"End ifSet mycomm = nothing
6. Stored Procedures that return both parameters and Record SetsSometimes, we need a stored procedure to return both parameters and record sets. For example, when using Stored Procedure paging, we need to return parameters such as the record set and total data. The following is a stored procedure for paging:
/* SP6 */Create procedure DBO. getuse
Returns the stored process for both parameters and recordsetsSometimes, we need the stored process to return both parameters and recordsets, such as returning the recordset and the total amount of data while using the storage process paging. The following is a stored process that handles paging:
/*sp6*/CREATE PROCEDURE DBO. Getuserlist@IPAGECOUNT INT OUTPUT,--Total pages@IPAGE INT,--current page number@IPAGESIZE INT--Number of records per pageAsSET N
int i;int ipage=5; Pagesint allpage; Page numbersint pages; The number of pages acceptedint cpage=1; When you are in front ofint spage; Start Pageint allcol=0;Vector V=null;Data Library Connection soundsConnection Conn=null;Java.lang.String Sql,pagesql;Java.sql.ResultSet rs,pagers;Statement Statement=null;String kmsdb= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=db_szscz";Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver");conn
JS int i;
int ipage=5; Pages
int allpage; Page numbers
int pages; The number of pages accepted
int cpage=1; When you are in front of
int spage; Start Page
int allcol=0;
Vector v=null;//Data Library connection sounds
Connection Conn=null;
Java.lang.String Sql,pagesql;
Java.sql.ResultSet rs,pagers;
Statement Statement=null;
String kmsdb= "Jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=dbname";
Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServ
Modular Paging
1. Query statement block
Get the current file nametemp = Split (Request. ServerVariables ("URL"), "/"FY = temp (UBound (temp))Set Rs=server.createobject ("Adodb.recordset")If not IsEmpty (Request ("page") ThenPagecount=cint (Request ("page")ElsePagecount=1End IfSql= "SELECT query Statement"Rs.Open sql,conn,1,1rs.pagesize=10 Number of paging recordsIf Pagecount>rs.pagecount or pagecountPagecount=1End IfIf Rs.eof and Rs.bof then%>
Sorry, no records match the search criteria!
2. Dis
Process . prepared = true' requires that the SQL command be compiled first 'Return value should be declared first . parameters. append. createparameter ("return", 2, 4) 'the Declaration Order of the following two parameters is also reversed. . parameters. append. createparameter ("@ username", 40) . parameters. append. createparameter ("@ userid", 3,1, 4, userid) . execute end with If mycomm (0) = 1 then username = mycomm (1) else username = "this user does not have" end if set mycomm
. append. CreateParameter ("@ UserID", 3, 1, 4, UserID). ExecuteEndIf MyComm (0) = 1 thenUserName = MyComm (1)ElseUserName = "this user does not exist"End ifSet MyComm = Nothing
6. Stored Procedures that return both parameters and Record SetsSometimes, we need a stored procedure to return both parameters and record sets. For example, when using Stored Procedure paging, we need to return parameters such as the record set and total data. The following is a stored procedure for paging:
/* SP6 */Cre
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.