SoFunction
Updated on 2025-04-13

Zou Jian’s paging storage process has been changed

Zou Jian’s paging storage process--changed it
Because Zou Jian’s paging stored procedure cannot return the total number of records, he has to count it again every time he paging, so he added a return number of records to it, which is easy to use.

@iPageCount int OUTPUT  --Define the output variable and place it on @QueryStr

....

exec('select'+@FdShow+'from'+@QueryStr+@FdOrder) -Stat the number of records, put it-If the first page is displayed...
Select @iPageCount = @@rowcount

Calling method (ASP):

MyConStr = "Driver={SQL Server};server=(local);Uid=artme;Pwd=***;Database=artme"
    DIM MyComm,UserID,UserName
    Set MyComm = ("")
    with MyComm
.ActiveConnection = MyConStr    'MyConStr is a database connection string
.CommandText     = "p_show" 'Specify the stored procedure name
.CommandType     = 4           'Indicates that this is a stored procedure
.Prepared      = true     'Require SQL commands to be compiled first
 . .CreateParameter("RETURN",2,4)
 . .CreateParameter("@iPageCount",3,2)
 . .CreateParameter("@QueryStr",200,1,4000,"select * from zw_language")
 . .CreateParameter("@PageSize",3,1,4,5)
 . .CreateParameter("@PageCurrent",3,1,4,1)
 . .CreateParameter("@FdShow",200,1,4000)
 . .CreateParameter("@FdOrder",200,1,1000)
       .Execute
    end with
   iCount = MyComm(1)
    iCount




Trackback: /?PostId=566682