1, database connection.
ASP to connect to an Access database:
ASP to connect to SQL database:
The DW uses string concatenation code:
"Driver={microsoft Access Driver (*.mdb)};D bq= Absolute path to the database"
When you are done, open the
Program code
' function: Definition converted to JavaScript string output (in convention JavaScript, quoted strings in single quotes)' Source: http://www.cncms.com/asp.asp
Function Str4js (sstring)STR4JS = sstringIf IsNull (sstring) Then str4js = "
Program code
' function: to tick which values on a specified checkbox' Source: http://www.cncms.com/asp.asp
Function checkboxscript (ByVal formelement, ByVal elementvalue) checkboxscript = "" & vbCrLf & "String.prototype." Checkboxscript =
This is an ASP tutorial delete the specified record program code Oh, the instance by clicking Connect to delete the page, and execution deletes,
Database Tutorial ConnectionsSub Opendb ()Set Rs=server. CreateObject ("Adodb.recordset")Set
There are two main types of ASP acquisition parameters:
Request.QueryString (Get) or Request.Form (POST)
We sometimes write Id=request ("ID") to simplify the code, because there is a problem with the writing ...
The original Web service reads
some days ago, some netizens asked: the ASP recordset output into N columns of the form display method, now write a, convenient for everyone to use.
' Define variablesDim Cn,rs,sql
SQL = "Select CustomerID from Orders"
' Total recordsDim
This article mainly introduced the asp.net from the client to detect potentially dangerous Request.Form value 3 kinds of solutions, this is the asp.net development in a more common classic question, the need friend may refer to under
What to do
Dim id Dim Rs,sql id = Replace (Trim (request.querystring "id"), "'", "") If session ("id" &id) <> "Then set Rs = Server.CreateObject (" ADODB. Recordset ") sql =" SELECT * from News Where id= "&id rs.open sql,conn,3,3 if rs.eof and R
in writing asp.net applications, sometimes in order to better control the path of static files, such as in the template page or user control set JS or CSS file path, etc., using absolute path is unavoidable. Here are a few ways to get an absolute
The method needs to pass the encoding of the target page, such as System.Text.Encoding.Default or System.Text.Encoding.UTF8.
If any expert knows how to automatically determine the encoding format of the target page, please tell in the comments.
NextRecordset and GetRows are two attributes of the recordset to improve the speed of the batch query is very effective, you may use very little, share the use of these two methods:
GetRows Method: The recordset Recordset is extracted into a
Global.asa is a text file found in your home directory (/Global.asa). Lou shows the basic extructure a Global.asa file.
Global.asa
The file will be activated in this case:
When the first visitor visits our web pageWhen the new session starts.In
Session ("aname") = ""Session ("Admin_flag") = ""Session. Abandon ()Response. Redirect ("Login.asp")%>Session.timeout=60If IsEmpty (Session ("Aname")) or Len (Sessions ("Aname")) =0 or IsEmpty (session ("Admin_flag")) or Len ("Admin_flag" ) =1 or
In For Each ... Next loop like, for ... Next loop. Rather than the specified number of repeated statements,
Every name ... Next loops a repeating collection of objects (or each item) for each element in the array.
The following code fragment
To configure the database connection string in Webconfig, the code is as follows:
Copy Code code as follows:
Then get the connection string inside the Webform_1.aspx.cs to add the following reference;
Copy Code code as follows:
using
When we write ASP database programs, we usually use SQL statements, and when we add data and update the data, we usually use the way: INSERT into message (Incept,sender,title,content,sendtime, Flag,issend) VALUES (' "&incept (i) &", ' &membername& "'
ASP tutorial Simple Online user statistics codeThis code is using the ASP apliction and session instance of OH.Sub Application_OnStartApplication. Lock ()Application ("Use_online") =0Application. UnLock ()End SubSub Application_OnEndApplication.
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