I have organized some code commonly used by ASP beginners (5)

xiaoxiao2021-03-06  90

<%

Function Name Function Function

CBOOL (String) Convert to Boolean

CBYTE (String) Converts to the value of byte type

CCUR (String) Converts to currency class values

CDATE (STRING) Converts to the value of the previous type

CDBL (String) Convert to Dual Accuracy Value

CINT (String) Convert to integer values

CLNG (String) Converts to long integer values

CSNG (String) Converts to a single precision value

CSTR (var) converted to string values

Str (var) value is converted to a string

Val (string) string conversion to values

****** ******

****** ******

ABS (NMB) Returns the absolute value of the number

ATN (NMB) returns a number of annectaneous cut

COS (NMB) Returns an angle of Yu Xuan value

Exp (NMB) Returns the secondary value of the natural index

INT (NMB) Returns part of the digital plastic (carry)

FIX (NMB) Returns to the digital shaping (going) part

Formatpercent (Expression) Returns%

HEX (NMB) returns the number of data for data

LOG (NMB) Returns Natural Logar

OCT (NMB) Returns the number of 8-based numbers

RND returns a random number greater than "0" and less than "1"

SGN (NMB) judges a number of logged numbers

SIN (NMB) Returns the angle of Zhengyu

SQR (NMB) Returns the secondary square root of the number

Tan (NMB) returns a number of positive cut values

ASC (String) Returns an ASCII string

CHR (Charcode) Returns Character according to character code

Instr (String, SearchStr) Returns the first character position of the search string, String is a string, and SearchStr is a string that is searched.

INSTRREV (STRING, SearchStr) is the same, just starts from the right side

LCASE (var) becomes a string

LEFT (STRING, NMB) Returns NMB string from the left from the String

Len (string) Returns the length of the string

Ltrim (String) Cut the space left on the left side of the string

Filter (InputStrings, Value) Returns the word set of the array of strings, inputstrings is a string group, and Value is the character looking for in an array.

RTRIM (String) Cut the space on the right side of the string

Trim (String) Clipping String Space

MID (String, Start, LEN) Returns the LEN character starting from the Start position in String

Replace (String, Find, WITHSTR) In string String, replaced Find string with WITHSTR

Right (String, NMB) Returns the NMB string starting from the right side from String

Space (NMB) Returns a string of the specified space

Strcomp (string1, string2) compares two strings

Ucase (string) becomes uppercase

****** ******

****** ******

Date () Returns the current system date

DATEADD (Interval, NMB, DATE) Returns the date with an underlying time to specify the date of the time interval, Interval is the interval type, YYY-year, M-month, D-day, H-hours, N-min.

DateDiff (Interval, NMB1, NMB2) returns two time intervals, the meaning of Interval

DateValue (Date) Date Date in Date

Day (date) returns the number of days

FormatorTime (date) Returns formatted expressions express

Hour (TIME) returns hours number

Minute (TIME) returns the number of minutes

Month (date) returns the month in the date

NOW () return system date and time

Second (TIME) returns the number of seconds in the time () Returns the current time of the system

Weekday (date) returns the day of the week

WeekdayName (Date) Returns the Chinese name of the day

Year (date) returned year

Isarray (var) determines whether a variable is an array

Isdate (var) determines if a variable is a date

Isnull (var) determines whether a variable is empty

IsNuMeric judgment does the expression contain values

IsObject (var) determines whether a variable is an object

TypenAme (var) data type of the variable

****** ******

****** ******

Array (list) Returns an array

CreateObject (Class) Create an object

GetObject (PathFileName) Get file objects

InputBox (prompt) provides a dialog for input data

LBound (ArrayP returns the minimum index of array

Msgbox (String) Output a message box

Split (ListStr) Returns a one-dimensional array from a list string

Ubound (array) Returns the maximum index of an array

%>

<%

'

'◆ Module Name: Public flip module

'◆ File name: turnpage.asp

'◆ Introduction parameters: rs_tmp (Record Set), PageSize (number of records displayed per page)

'◆ Export: Record set flood display function

'

'

Sub Turnpage (Byref RS_TMP, Pagesize) 'RS_TMP Recording Set; Pagesize's number of records displayed per page;

DIM TOTALPAGE 'Total Page

Dim Pageno 'currently displayed is the first few pages

Dim RecordCount 'total record number

RS_TMP.PAGESIZE = PageSize

Recordcount = rs_tmp.recordcount

Totalpage = int (recordcount / pagesize * -1) * - 1

Pageno = Request.QueryString ("Pageno")

'Enter the number of pages directly;

IF Request.form ("Pageno") <> "" "" "" "" Pageno ")

'If you don't have a few pages, the first page is displayed by default;

IF Pageno = "" "THEN PAGENO = 1

IF Recordcount <> 0 THEN

RS_TMP.AbsolutePage = PAGENO

END IF

'Get the current file name so that each page is turned on at the current page;

DIM FileName, Postion

FileName = Request.servervariables ("script_name") Postion = INSTRREV (filename, "/") 1

'Get the current file name, make the link to the current file;

FILENAME = MID (filename, post)

%>

Call example:

File name: news.asp

<%

DIM CONN, RS_NEWS

Set conn = server.createObject ("adoDb.connection")

CONN.OPEN "CPM", "CPM", "CPM"

DIM SQL

SQL = "SELECT * from news"

SET RS_NEWS = Server.createObject ("AdoDb.Recordset")

RS_NEWS.OPEN SQL, CONN, 1, 3 'acquisition record set

'Public flip module start%>

<%

Dim rowcount

RowCount = 10 'Number of records displayed per page

Call Turnpage (RS_News, Rowcount)

'Community flop module end%>

<%

IF not rs_news.eof

Do While Not Rs_News.eof and Rowcount> 0

%>

<%

Rowcount = RowCount - 1

RS_News.Movenext

Loop

END IF

%>

转载请注明原文地址:https://www.9cbs.com/read-102197.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.035, SQL: 9
News Number

News Title

Release Date

<% = rs_news ("id")%>

<% = rs_news ("name")%>

<% = rs_news ("date")%>