Functions commonly used by ASP

Source: Internet
Author: User
ASP commonly used functions, I hope to be able to use.
<%
Dim db
db= "Dbms.mdb"
'******************************************************************
' Execute the SQL statement, do not return a value, the SQL statement best is as follows:
' Update table name set field name =value, field name =value where field name =value
' Delete from table name where field name =value
' Insert into table name (field name, field name) VALUES (value,value)
'******************************************************************
Sub noresult (SQL)
Dim conn
Dim connstr
Set conn = Server.CreateObject ("ADODB. Connection ")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("&db&")
Conn. Open ConnStr
Conn.execute SQL
Conn.close
Set conn=nothing
End Sub

'*******************************************************************
' Executes the SELECT statement, returning the Recordset object. The object is read-only. Which means you can't update it.
'*******************************************************************
Function result (SQL)
Dim conn
Dim connstr
Dim rcs
Set conn = Server.CreateObject ("ADODB. Connection ")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("&db&")
Conn. Open ConnStr
Set RCS = Server.CreateObject ("ADODB.") Recordset ")
Rcs.open sql,conn,1,1
Set result = RCS
End Function

'*******************************************************************
' Pop-up dialog box
'*******************************************************************
SUB Alert (message)
message = replace (message, "'", "'")
Response.Write ("<script>alert" (' & Message & ') </script> ")
End Sub

'*******************************************************************
' Returns to the previous page, generally used to determine whether the information is submitted completely

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.