Cool Universal Paging Display Control (iii) Display category table

Source: Internet
Author: User
Tags functions include query table name
Pagination | control | Show now, we can go further and show the category table so that users can view different content by selecting different categories. How can we solve this problem?

We can consider this:
1, the choice of the category also as a query
2, in order to save the page space, put the category in the Drop-down list box, while providing "all categories" item, so that users can browse all the information

So, we put the categories in the Query.inc

In addition, we put Thescript and Myconnstr, thepagesize into Function.inc, so that the page structure looks more reasonable.

Note the Getscriptname () function, which obtains the ASP's name from the file name, and the Add, delete, edit, view as the system's keyword after the filename, and is filtered, for example:

Theactionscript = Getscriptname ("sample_edit.asp")
Theactionscript value is "sample"


This allows us to change the additions and deletions of a table to a different file, for example:

list_add.asp Add records
list_delete.asp Delete
list_edite.asp modification
List_view.asp View

In the next chapter, we will use the Theactionscript, you will find that with it, many functions can be summed up, merged.


Please see sample3.asp




< a > ASP files that require paging

Sample3.asp


<!--#include file= ". /inc/functions.inc "-->
<%
'//////////////////////////////////////////////////////////
'
' Define table name
'
'//////////////////////////////////////////////////////////

Thetablename= "AddressBook"

'//////////////////////////////////////////////////////////
'
' Query criteria
'
'//////////////////////////////////////////////////////////

Thequeryfield = "FLD" & Thetablename & "_nickname" query field, full name
Thequerytitle = "nickname" Field display title
thequerytable = Table with VW & Thetablename field, full name

Thequeryclass = thetablename & "_class" category table name, remove TBL, VW prefix
Theclassid = C2int (Request ("ClassID")) ' Current category number

' If this is a query pattern, then construct a fuzzy query statement
If request ("mode") = "Query" Then
%><!--#include file= ". /inc/control/query_result.inc "--><%
Else
' Otherwise ignore
Thequerycon = "1>0"
End If

'//////////////////////////////////////////////////////////
'
' Restrictive conditions
'
'//////////////////////////////////////////////////////////

Thelimitcon = "FLD" & Thetablename & "_userid=" & Session ("UserID")

If Theclassid > 0 Then
Thelimitcon = Thelimitcon & "and fld" & Thequeryclass & "Id=" & Theclassid
End If

'//////////////////////////////////////////////////////////
'
' Construct the SQL statement
'
'//////////////////////////////////////////////////////////

Usql = "SELECT * from" & thequerytable & "where" ("& Thequerycon &") and ("& Thelimitcon & " ) "

%>
<!--#include file= ". /inc/control/navigator_init.inc "-->

<title>test</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" href



Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.