Real page display with ASP

xiaoxiao2021-03-06  24

1. Table structure definition:

---- Table Name: Product

---- Table Name: Product

---- Field name: Product number: Product_ID

---- Product Name: Product_name

2. Dynamic description:

---- Use the household input to the product number, do not have to enter the full name. Method for using the inquiry inquiry. Record of the full foot condition.

---- Use the household input to the product number, do not have to enter the full name. Method for using the inquiry inquiry. Record of the full foot condition.

3. Code script

---- The entire program has three ASP files (omitted HTML language part)

---- The entire program has three ASP files (omitted HTML language part)

---- 1 User Check Data Input Form: Input.asp

----- User Enter the product number

Value = "Submit" name = "b1">

2. One of the paging handles: prod.asp

---- User submit form input.asp trigger

<% CID = TRIM (Request.form ("ID"))%>

<% Set rlt = creteObject ("AdoDb.Recordset")%>

****** Create a Recordset object

<% Sql = "SELECT * from produuct where product_id like"

& CID & " '%'">

<% Rlt.open sql, "uid = ncgi; pwd = SQL; DSN = TCGI", 1%>

****** Execute SQL statements

<% IF rlt.pagecount <1 THEN%>

No record

Return

<% ELSE%>

------------------- North

pole

star

book

Library || http: // www.

eBook007.com

***** The following display query information: Display style:

***** A total of XX Pages XXX Book Recording Page: 1 .2 .3. 4. 5 .........

A total of <% = rlt.pagecount%> page

<% = Rlt.recordcount%> Book record

Page number: <% for i = 1 to rlt.pagecount%>

<% CID = RLT ("Product_ID")

& id = <% = CID%>>

<% = I%>.

<% Next%>


<% Rlt.pageSize = 20%> ****** The following display Product list: Display style:

****** 1.xxxx

****** 2.xxxx

****** ...........

<% Rlt.absolutepage = 1%>

<% For i = 1 to rlt.pageSize%>

<% If rlt.eof dam

EXIT for

END IF%>

  • <% = I%>. <% = TRIM (RLT ("Product_name"))

    <% Rlt.movenext

    NEXT%>

    <% Rlt.close%>

    3. Page 2 of the Page Processor: Propage.ASP

    ---- User Selection (Page Number: 1 .2 .3. 4. 5 .........)

    <% CID = TRIM (Request.QueryString ("ID")))%>

    <% Rlt.absolutepage = request.QueryString ("PCNT")%>

    ****** The above part is the same as prod.asp *****

    <% For i = 1 to rlt.pageSize%>

    <% If rlt.eof dam

    EXIT for

    END IF%>

  • <% = I%>. <% = TRIM (RLT ("Product_name"))

    <% Rlt.movenext

    NEXT%>

    <% Rlt.close%>

    four. Complete and express

    ---- You can make the user to set the length of each page. The method is to use the session pair of optimistic care users to pick up the user.

    ---- You can make the user to set the length of each page. The method is to use the session pair of optimistic care users to pick up the user.

    <% session ("size") = Request.form ("size")%>

    Use the following statement in the <% rlt.pagesize = 20%> one sentence in prod.asp

    <% IF session ("size") = "" ""

    Rlt.pageSize = 20

    Else

    Rlt.pageSize = session ("size")

    END IF%>

    Troubleshooting

    1. The key to page features:

    PageSize Absolute Application

    PageSize: Size per page

    AbsolutePage: The cursor is positioned to the page. For example, there are 20 records, divided into two pages, ten per page.

    AbsolutePage = 1 starts from the first record.

    AbsolutePage = 2 starts from the eleventh record.

    2. <% rlt.open SQL, "UID = NCGI; PWD = SQL; DSN = TCGI", 1%>

    DSN: System Data Source Name, UID: User Name, PWD: User Password, 1: Cursor Type

    You must be in the control panel ->

    32-bit ODBC establishes system data sources, remember is system data source

    Not user data source

    Cursor Type: 0, is the default value, but if you want to implement the page function cursor type, you must set it to 1

    Otherwise, the RecordCount PageSize PageCount property cannot be used.

    3.Request.form ("ID") and Request.QueryString ("ID") The name is ID

    Request.QueryString ("ID") refers to the data from the URL


  • New Post(0)