ASP learning summary 2

xiaoxiao2021-03-06  103

p; End function

[Call] strsubname reference subroutine var = strfunname (arg [1], ..) reference function

Subprints and custom functions can be recursively called;

ASP six major objects common statement demonstration:

Response: response.write strvar / "string": write the parameter value or string to the web page equivalent to embed <% = strvar / "string"%> response.end: Stop page compile in the HTML tag, and will have compiled content Output to Browser Response.buffer = true | false: Whether the cached settings are used when compiling, generally set Response.flush on the page header: Force output page Compiled part content Response.clear: Clear the data in the buffer to RESPONSE .Redirect URL: Stop page compile or output, reprint specify the desired page response.isclientConnected: Return true | false, check if the user is still connected to response.charset: Set the page encoding type, ie Response.contentType [= contentType]: Set the page file type, the same with response.expires [= number]: Set the page failure time, unit minutes Response.expiresabsolute [ = [DATE] [TIME]]: Set the absolute time of page failure response.status = statusdescription: Settings page status Description Request: Request ("passstrname": read web page transfer values, including forms and PassstrName = value & passStrName_n = value_n Form Request [.collection | Property | Method] Request.QueryString ("PassstrName": Read the form value passed by the get method and? PassstrName = valueRequest.QueryString (varible) [(index) .count] Request.form ("passstrname"): Read the pure table single field of the POST method Request.form (INDEX) .count] Request. ServerVarible: Read the client system environment variable, see Request.BinaryRead (count): Read the transfer value of the specified byte number Request.TotalBytes: The length of the query body, in bytes, only Reading: The same name form, such as: checkbox, if there is a number of values, pass the form, right, strname = value1, value2, ... You need to split the value of each value with the SPLIT function Multiple, similar to Checkbox, the value of Textarea can contain a wrap Character, convert with Replace to
to meet the format requires session: (User global variable) session ("sesname") = value: Store session variables,

You can also read this value session ("sesName") = EMPTY: Determines whether the session value is existed, ISempty (SESSION ("SESNAME")) = true | false: Determines whether the session value exists Session.Timeout = NUM: Set the presence of the session variable, unit minutes session.abandon: Clear all session variables session.Session ID: session variable ID serial number, read-only Application: (Application Global Variable) Application ("AppName") = Value : Store Application Values, or reads this value Application ("AppName") = EMPTY: Determines whether the application value is = true | false: Determine if the application value exists Two Method Application.lock: Application Variable Value locks to prevent the variable value application.Unlock: Application Variable value unlock, allowing change to change variables: session and application variables can be used to store arrays and system objects, the reference method is variable Name is equivalent to array name, but it is not possible to change its value, you need to use the temporary array to modify the value, then assign the structure of the session and Application Variables Global.asa file: <% @ language = "vbscript"%> <% sub Application_OnStart ... End Sub Sub Application_ONEND ... END SUB SUB SESSION_ONSTART ... END SUB SUB SUB SESSION_ONEND ... End Sub%> Server: Server.mAppath ("fileurl": Mapping file name The server site absolute address, PATH = Server.mappath (./) can get a virtual directory root path server.htmlencode ("S "): Convert to a string that can directly display the HTML format, such as: <,> and other Server.urlencode (" string "): Convert to browser address encoded set var = server.creatobject (" objName ": Created Object Variable Server.ScriptTimeout = Numseconds: ASP Program page Perform time limit, in seconds unit cookies: stored in the user's native variable, each cookie's maximum byte 4KB, up to 300 cookie 1.2MBRESPONSE.COOKIES (" Strcookiename ") = value: Store the cookie variable, you can also read this value response.cookies.

Strcookiename ") =" ": Judging whether it is empty response.cookies (" strcookiename "). Expires = Date: Variable validity period, with a day unit, less than the current time to expire Response.Cookies (cookie [(key) .attribute]) : Standard syntax ObjectContext control ASP transaction ObjectContext.ontransactionAbort: The abandoned transaction event is excited, ObjectContext.ontransactionCommit: ObjectContext.ontransactionCommit after the script is completed: The successful transaction event is excited, ObjectContext.Setabort occurs after the script is completed. give up one type of transaction ObjectContext.SetComplete: front cover any calls ObjectContext.SetAbort method is called Msgbox "string" / strName: VBscript balloon form Onsubmit event: written in the same page Function FormName_onsubmit () .. FormName_onsubmit = True / False..end function, the page will perform the statement before commit, and determine if the submission task is completed according to the return value. Database connection string example: Access2000: conn.Open "provider = microsoft.jet.Oledb.4.0; data source = "& Server.Mappath (" dbase / liuyan.mdb ") conn.d" provider = microsoft.jet.oledb.4.0; data source = "& Server.mappath (" dbase / liuyan.mdb ") &"; password = Admin "RecordSet.open" Data Table Name ", CONN, 2, 2SQLSERVER2000: Conn.open" provider = sqloledb.1; user ID = sa; password = admin; initial catalog = public = admin; "CONN. Open "provider = sqloledb; data source = hyserver; uid = sa; pwd =; d ATABASE = PUBS "Recordset.open Strsql, CONN, 2, 2DB

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

New Post(0)