Commonly used functions of ASP, I hope they can be used.
<%
dim db
db=dbms.mdb
'************************************************************************
'Execute the SQL statement without returning the value. The best SQL statement 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
'*********************************************************************************
'Execute the select statement and return the recordset object. This object is read-only. That is, it cannot be updated
'*********************************************************************************
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
'*********************************************************************************
' The dialog box pops up
'*********************************************************************************
Sub alert(message)
message = replace(message,',/')
Response.Write (<script>alert(' & message & ')</script>)
End Sub
'*********************************************************************************
' Return to the previous page, usually used after judging whether the information is submitted completely
'*********************************************************************************
Sub GoBack()
Response.write (<script>history.go(-1)</script>)
End Sub
'*********************************************************************************
' Redirect another connection
'*********************************************************************************
Sub Go(url)
Response.write (<script>location.href(' & url & ')</script>)
End Sub
'*********************************************************************************
' Replace the html tag
'*********************************************************************************
function htmlencode2(str)
dim result
dim l
if isNULL(str) then
htmlencode2=
exit function
end if
l=len(str)
result=
dim i
for i = 1 to l
select case mid(str,i,1)
case <
result=result+<
case >
result=result+>
case chr(13)