ASP is an abbreviation for Active Server page, meaning "dynamic servers pages." ASP is an application developed by Microsoft to replace the CGI script program, it can interact with database and other programs, it is a simple and convenient programming tool. Connect the article >>
11.ACCESS Database connection:
<%
Option Explicit
Dim startime,endtime,conn,connstr,db
Startime=timer ()
' Change database name
db= ' Data/dvbbs5.mdb "
Set conn = Server.CreateObject (" ADODB. Connection ")
connstr=" Provider=Microsoft.Jet.OLEDB.4.0;Data source= "& Server.MapPath (db)
If your server is powered by an older version of Access, use the following connection method
' connstr= ' driver={microsoft Access Driver (*.mdb)};d bq= "& Server.MapPath ( DB)
Conn. The Open connstr
function CloseDatabase
conn.close
Set Conn = Nothing end
function
%>
12.SQL Database connection:
<%
Option Explicit
Dim startime,endtime,conn,connstr,db
Startime=timer ()
connstr= "Driver={sql Server};server=hudenq-n11t33nb;uid=sa;pwd=xsfeihu;database=dvbbs "
Set conn = Server.CreateObject (" ADODB. Connection ")
Conn. The Open connstr
function CloseDatabase
conn.close
Set Conn = Nothing end
function
%>
13. Open the page code with the keyboard:
<script language= "javascript" >
function ctlent (eventobject)
{
if (Event.ctrlkey && WINDOW.EVENT.KEYCODE==13) | | (Event.altkey && window.event.keycode==83))
{
window.open (' URLs ', ', ', ')
}
}
</script>
This is Ctrl+enter and Alt+s's code. Check the ASCII code of the keyboard and change it.
14. Let the layer not be covered by the control code:
<div z-index:2><object xxx></object></div> # front
<div z-index:1><object xxx> </object></div> # behind
<div id= "Layer2" style= "Position:absolute; top:40;width:400px; height:95px; Z-index:2 ">
<table height=100% width=100% bgcolor=" #ff0000 "><tr>
<td height=100% width= 100%></td></tr></table><iframe width=0 height=0></iframe></div>
< Div id= "Layer1" style= "Position:absolute; top:50;width:200px; Height:115px;z-index:1 ">
15. Dynamic Network Flash Advertising code:
<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase=http://download.macromedia.com/pub /shockwave/cabs/flash/swflash.cab#version=5,0,0,0
width= "468" height= "> <param name=movie
value= "Images/yj16d.swf" >
<param name=quality value=high>
<embed src= "images/dvbanner.swf" quality= High
pluginspage=http://www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash;;;;;;;;;;;;
Type= "Application/x-shockwave-flash" width= "468" height= "></embed></object>"
16.VBS pop-up window Small code:
<script language=vbscript>
MsgBox "You have not registered or landed forum", "0", "Boutique Forum"
location.href = "Login.asp"
</ Script>
17. Functions to modify file-specific content using the FSO:
function Fsochange (filename,target,string)
Dim objfso,objcountfile,filetempdata
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set objcountfile = objFSO.OpenTextFile (Server.MapPath ( filename), 1,true)
filetempdata = Objcountfile.readall
objcountfile.close
filetempdata=replace ( filetempdata,target,string)
Set objcountfile=objfso.createtextfile (Server.MapPath (filename), True)
Objcountfile.write filetempdata
objcountfile.close
set objcountfile=nothing
set objFSO = Nothing End
Function
18. Functions to read the contents of a file using the FSO:
function fsofileread (filename)
Dim objfso,objcountfile,filetempdata
Set objFSO = Server.CreateObject (" Scripting.FileSystemObject ")
Set objcountfile = objFSO.OpenTextFile (Server.MapPath (filename), 1,true)
Fsofileread = Objcountfile.readall
objcountfile.close
set objcountfile=nothing
set objFSO = Nothing
19. Use the FSO to read a file a row of functions:
function Fsolinedit (filename,linenum)
if linenum < 1 then Exit Function
Dim fso,f,temparray,tempcnt
Set FSO = server. CreateObject ("Scripting.FileSystemObject")
if not fso.fileexists (Server.MapPath (filename)) then Exit function
Set F = fso.opentextfile (Server.MapPath (filename), 1)
if not F.atendofstream then
tempcnt = F.readall
F.close
Set f = Nothing
Temparray = Split (TEMPCNT,CHR () &chr)
if Linenum>ubound (Temparray) +1 then
exit Function
Else
fsolinedit = Temparray (lineNum-1) End
If End
function
20. Functions to modify file-specific content using the FSO:
function Fsochange (filename,target,string)
Dim objfso,objcountfile,filetempdata
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set objcountfile = objFSO.OpenTextFile (Server.MapPath ( filename), 1,true)
filetempdata = Objcountfile.readall
objcountfile.close
filetempdata=replace ( filetempdata,target,string)
Set objcountfile=objfso.createtextfile (Server.MapPath (filename), True)
Objcountfile.write filetempdata
objcountfile.close
set objcountfile=nothing
set objFSO = Nothing End
Function
21. Functions to read the contents of a file using the FSO :
function fsofileread (filename)
Dim objfso,objcountfile,filetempdata
Set objFSO = Server.CreateObject (" Scripting.FileSystemObject ")
Set objcountfile = objFSO.OpenTextFile (Server.MapPath (filename), 1,true)
Fsofileread = Objcountfile.readall
objcountfile.close
set objcountfile=nothing
Set objFSO =
Nothing End Function
22. Use the FSO to read a file a row of functions:
function Fsolinedit (filename,linenum)
if linenum < 1 then Exit Function
Dim fso,f,temparray,tempcnt
Set FSO = server. CreateObject ("Scripting.FileSystemObject")
if not fso.fileexists (Server.MapPath (filename)) then Exit function
Set F = fso.opentextfile (Server.MapPath (filename), 1)
if not F.atendofstream then
tempcnt = F.readall
F.close
Set f = Nothing
Temparray = Split (TEMPCNT,CHR () &chr)
if Linenum>ubound (Temparray) +1 then
exit Function
Else
fsolinedit = Temparray (lineNum-1) End
if
To this end, about the ASP commonly used code summary, for everyone to introduce finished, I hope to help.