|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
优点:简单易学、开发速度快、有很多年“历史”,能找到非常多别人做好的程序来用、配合activeX功能强大,很多php做不到的asp+activeX能做到,例如银行安全控件以下为援用的内容:
InsertingFormcontentintoDatabasewithASP.
<%
--Loader.asp--
--version1.5.2
--lastupdated12/5/2002
FaisalKhan
faisal@stardeveloper.com
www.stardeveloper.com
Classforhandlingbinaryuploads
ClassLoader
Privatedict
PrivateSubClass_Initialize
Setdict=Server.CreateObject("Scripting.Dictionary")
EndSub
PrivateSubClass_Terminate
IfIsObject(intDict)Then
intDict.RemoveAll
SetintDict=Nothing
EndIf
IfIsObject(dict)Then
dict.RemoveAll
Setdict=Nothing
EndIf
EndSub
PublicPropertyGetCount
Count=dict.Count
EndProperty
PublicSubInitialize
IfRequest.TotalBytes>0Then
DimbinData
binData=Request.BinaryRead(Request.TotalBytes)
getDatabinData
EndIf
EndSub
PublicFunctiongetFileData(name)
Ifdict.Exists(name)Then
getFileData=dict(name).Item("Value")
Else
getFileData=""
EndIf
EndFunction
PublicFunctiongetValue(name)
Dimgv
Ifdict.Exists(name)Then
gv=CStr(dict(name).Item("Value"))
gv=Left(gv,Len(gv)-2)
getValue=gv
Else
getValue=""
EndIf
EndFunction
PublicFunctionsaveToFile(name,path)
Ifdict.Exists(name)Then
Dimtemp
temp=dict(name).Item("Value")
Dimfso
Setfso=Server.CreateObject("Scripting.FileSystemObject")
Dimfile
Setfile=fso.CreateTextFile(path)
FortPoint=1toLenB(temp)
file.WriteChr(AscB(MidB(temp,tPoint,1)))
Next
file.Close
saveToFile=True
Else
saveToFile=False
EndIf
EndFunction
PublicFunctiongetFileName(name)
Ifdict.Exists(name)Then
Dimtemp,tempPos
temp=dict(name).Item("FileName")
tempPos=1+InStrRev(temp,"")
getFileName=Mid(temp,tempPos)
Else
getFileName=""
EndIf
EndFunction
PublicFunctiongetFilePath(name)
Ifdict.Exists(name)Then
Dimtemp,tempPos
temp=dict(name).Item("FileName")
tempPos=InStrRev(temp,"")
getFilePath=Mid(temp,1,tempPos)
Else
getFilePath=""
EndIf
EndFunction
PublicFunctiongetFilePathComplete(name)
Ifdict.Exists(name)Then
getFilePathComplete=dict(name).Item("FileName")
Else
getFilePathComplete=""
EndIf
EndFunction
PublicFunctiongetFileSize(name)
Ifdict.Exists(name)Then
getFileSize=LenB(dict(name).Item("Value"))
Else
getFileSize=0
EndIf
EndFunction
PublicFunctiongetFileSizeTranslated(name)
Ifdict.Exists(name)Then
temp=LenB(dict(name).Item("Value"))
Iftemp<=1024Then
getFileSizeTranslated=temp&"bytes"
Else
temp=FormatNumber((temp/1024),2)
getFileSizeTranslated=temp&"kilobytes"
EndIf
Else
getFileSizeTranslated=""
EndIf
EndFunction
PublicFunctiongetContentType(name)
Ifdict.Exists(name)Then
getContentType=dict(name).Item("ContentType")
Else
getContentType=""
EndIf
EndFunction
PrivateSubgetData(rawData)
Dimseparator
separator=MidB(rawData,1,InstrB(1,rawData,ChrB(13))-1)
DimlenSeparator
lenSeparator=LenB(separator)
DimcurrentPos
currentPos=1
DiminStrByte
inStrByte=1
Dimvalue,mValue
DimtempValue
tempValue=""
WhileinStrByte>0
inStrByte=InStrB(currentPos,rawData,separator)
mValue=inStrByte-currentPos
IfmValue>1Then
value=MidB(rawData,currentPos,mValue)
DimbegPos,endPos,midValue,nValue
DimintDict
SetintDict=Server.CreateObject("Scripting.Dictionary")
begPos=1+InStrB(1,value,ChrB(34))
endPos=InStrB(begPos+1,value,ChrB(34))
nValue=endPos
DimnameN
nameN=MidB(value,begPos,endPos-begPos)
DimnameValue,isValid
isValid=True
IfInStrB(1,value,stringToByte("Content-Type"))>1Then
begPos=1+InStrB(endPos+1,value,ChrB(34))
endPos=InStrB(begPos+1,value,ChrB(34))
IfendPos=0Then
endPos=begPos+1
isValid=False
EndIf
midValue=MidB(value,begPos,endPos-begPos)
intDict.Add"FileName",trim(byteToString(midValue))
begPos=14+InStrB(endPos+1,value,stringToByte("Content-Type:"))
endPos=InStrB(begPos,value,ChrB(13))
midValue=MidB(value,begPos,endPos-begPos)
intDict.Add"ContentType",trim(byteToString(midValue))
begPos=endPos+4
endPos=LenB(value)
nameValue=MidB(value,begPos,((endPos-begPos)-1))
Else
nameValue=trim(byteToString(MidB(value,nValue+5)))
EndIf
IfisValid=TrueThen
intDict.Add"Value",nameValue
intDict.Add"Name",nameN
dict.AddbyteToString(nameN),intDict
EndIf
EndIf
currentPos=lenSeparator+inStrByte
Wend
EndSub
EndClass
PrivateFunctionstringToByte(toConv)
DimtempChar
Fori=1toLen(toConv)
tempChar=Mid(toConv,i,1)
stringToByte=stringToByte&chrB(AscB(tempChar))
Next
EndFunction
PrivateFunctionbyteToString(toConv)
Fori=1toLenB(toConv)
byteToString=byteToString&Chr(AscB(MidB(toConv,i,1)))
Next
EndFunction
%>
1、用户界面:
<scriptlanguage="JavaScript">
functionCheckAll(form)
{for(vari=0;i<form.elements.length;i++)
{vare=form.elements;
if(e.name!=chkall)
e.checked=form.chkall.checked;
}
}
</script>
</head>
<body>
<formmethod="post"action="del.asp"name="form1">
<table>
<tr>
<td><inputtype="checkbox"value="111"name="TradeName">电子邮件1</td>
</tr>
<tr>
<td><inputtype="checkbox"value="111"name="TradeName">电子邮件2</td>
</tr>
<tr>
<td><inputtype="checkbox"value="111"name="TradeName">电子邮件3</td>
</tr>
<tr>
<td><inputtype="checkbox"value="111"name="TradeName">电子邮件4</td>
</tr>
<tr>
<td><inputtype="checkbox"value="111"name="TradeName">电子邮件5</td>
</tr>
<tr>
<td><inputtype="checkbox"value="111"name="TradeName">电子邮件6</td>
</tr>
<tr>
<tdbgcolor="#F1FBFC"height="25"colspan="2">
<palign="left"><inputtype="checkbox"name="chkall"value="on"onclick="CheckAll(this.form)"><fontcolor="#FF9900">选中一切显现的动静</font></p>
</td>
<center>
</tr>
</table>
</form>
2、删除文件del.asp
<%
这行写毗连数据库的代码
dimID,strID
strID=""
ForEachstrIDInRequest.Form("TradeName")
ID=Cint(strID)
ifstrID""then
DelRs=Server.CreateObject("ADODB.Recordset")
Conn.Execute"DeleteFromTbnamewhereID="&Cstr(ID)
strID=""
endif
Next
Conn.Close
SetConn=Nothing
Response.Redirect"乐成删除!"
%>
强大的可扩展性。ASP具有强大的扩展性,可以实现与多种网络、硬件设备的连接:通过专用的通讯线路远程接入企业;通过远程拨号服务器为远程拨号客户提供服务;通过WAP为移动电话互联网客户服务。 |
|