LOGO OA教程 ERP教程 模切知识交流 PMS教程 CRM教程 开发文档 其他文档  
 
网站管理员

ASP资料收集

admin
2013年11月28日 11:43 本文热度 5471
1.Asp 对象与内置组件
1.1 Response
resPonse.write "html语句"
response.redirect "url"
response.writeBinary Variable (图像资料)
response.end
response.clear
response.Flush
response.AppenTLog "Information" ->iis login file
response.buffer=true/false -> 马上解释马上显示
response.ContentType="text/html" "image/gif"
response.CharSet "gb2312"
response.expirse=n 分 (0)
response.ExpireAbsolute=#9,2000 8:30:30#
response.status="403 Forbidden"

ResPonse.Cookies(cookie)[key]|(.attribute)=value
.cookies() 的属性.Domain
.expires 到期时间
.HasKeys
.Path
response.cookies("University")="TsingHua"
response.cookies("university").expires="January,1,2001"

response.cookies("university").("TsingHua")="January" 一个可有多值


1.2 Request
Request.form("ID")
request.querystring("ID")


1.3 Server变量和方法
ServerVariables
For each name in Request.ServerVariables
response.write("<br>"&name&"="&Request.serverVariables(name)
next
Server.method
server.createobject()
server.mappath()
server.HtmEncode("<html>") 不会被解释
server.urlEncode("url")

1.4 Session
session.collection|Property|method
<%@ EnableSessionstate=False%>
session.SessionID (会话标识)
session.Timeout (分钟为单位)
session.Abandon (破坏释放)

for i=1 to Session.Contents.Count
Response.write("<br>"&Session.contents(i))
next

1.5 Application
Application("aa")="aa"
set Application("My")=server.createobject("MYcomponent")

global.asa
<script language=Vbscript runat=server>
sub Application_onStart
Applicaiton.lock
Application("All")=0
Application("OnLine")=0
Application.unlock
end sub
Sub session_Onstart
Application.lock
Application("Online")= Application("ONline")+1
Application("all")= Application("all")+1
Application.unlock
end Sub

sub session_onend
Application.lock
Application("Online")=Application("Online")-1
end sub

Sub Application_Onend

end sub
</script>
1.6 内置组件 略

2.使用浏览器的能力
[browscap.ini 文件最新]
<%set Mybrow=server.createobject("mswc.browserType")
aa=mybrow.browser %>
browser: 浏览器类型 version: 版本号
majorver: 主版本 miorver: 辅版本
frames: 支持分屏 tables: 支持表格
cookies: 支持cookies backgroundsounds:支持bgsound
vbscript: 支持否 javascripts: 支持否
javaapplets: 支持否 activexcontrols: 支持否
beta: 是否是测试版 platform: os
win16: 16(win31) 32(win95 winnT)
3.文件存取
File Access:
1 FilesystemObject 文件系统基本方法
2 textstream 读写文本文件
3 file 处理单个文件
4 folder 处理文件夹
5 drive 磁盘驱动器与网络共享
File Access Component:
1 Files 文件夹中一系列文件
2 Folder
3 Drive
文件读写
<%
set Fobject=server.createobject("scripting.FilesystemObject")
set Tfile=Fobject.CreateTextFile("aa.txt")
""""" set Tfile=Fobject.opentextfile
""""" while not Tfile.atEndofStream
""""" response.write (tFIle.readline)
""""" wend
Tfile.writeline("hellp")
Tfile.close
%>
CreateTextFile(filename,[Overwrite(true/False)[,unicode]])
Opentextfile(filename[,Mode] [,Create] [,Format])
mode:1 ForReading , 8 ForAppending
Create 文件不存在是否创建 true/false
format -2 默认, -1 unicode , 0 ASCII

textstream的属性 和 方法
atendofLine Read(N)
atendofstream ReadLine()
column ReadAll
line Skip(n)
Close

文件的处理
set Fileobject=server.createobject(scripting.FileSystemOjbect)
set Tfile=Fileobject.opentextfile("aa.txt")
或者
set Tfile=FileObject.getFile("aa.txt")
FilesystemObject 方法 File 方法 File 属性
Fileobject.copyFile "aa.txt" "bb.txt" Tfile.copy "bb.txt" attributes 0 normal ,1 read-only
Fileobject.MoveFile "aa.txt" "bb.txt" Tfile.move "bb.txt" 2 hidden ,4 system 8 volume,
Fileobject.deleteFile "aa.txt" Tfile.delete 16 directory ,32 archive
64 alias ,128 compressed
dateCreated 创建日期
DateLastAccessed 最后访问日期
DateLastModified 最后修改日期
Drive 驱动器
name 文件名
ParentFolder 所在文件夹
path 全路径
size 文件字节数
type 文件类型

FileSystemObject 的方法
set FileObject=server.createobject(scripting.Filesystemobject)
FileObjet.FileExists(fileName)
FileObjet.GetFile(fileName)
Myfileobject.DirveExists("c:")
Myfileobject.GetDrive("C:")
Myfileobject.getDriveName(path)
Fileobject.CopyFolder "c:\aa" "d:\bb"
Fileobject.DeleteFolder "c:\aa"
Fileobject.FolderExists ("c:\aa")
Fileobject.GetFolder("c:\")
Fileobject.MoveFolder("c:\")

4.驱动器的操作与文件夹的操作
<%set myfileobject=server.createobject("scripting filesystemObject")
for each thing in myfileobject.driver %>
thing.driverletter
thing.totalsize
thing.availablespace
next
'FilesystemObject 方法
Myfileobject.DirveExists("c:")
Myfileobject.GetDrive("C:")
Myfileobject.getDriveName(path)
'driver 方法
set Dir=FileSystemobject.getDrive("C:")
dir.AvailableSpace() '可用空间
dir.driverletter 'drive name
dir.DriveType 'cd-rom removeable drive
dir.serialNumber 'serialNumber
dir.totalsize
dir.shareName
dir.VolumnName
'FilesystemObject 方法
Fileobject.CopyFolder "c:\aa" "d:\bb"
Fileobject.DeleteFolder "c:\aa"
Fileobject.FolderExists ("c:\aa")
Fileobject.GetFolder("c:\")
Fileobject.MoveFolder("c:\")
'Folder 方法
set Fol=FileSystemObject.getFolder("c:\MyFile")
for each thing in Fol.Files
response.write ("<p>"&thing) '
next
Fol.copyFolder "d:\bb" [,overwrite]
Fol.DeleteFolder
Fol.Files
Fol.name
Fol.moveFolder "c:\aa"

5.邮件发送
[ smtp service ]
asp 发送email
sub sendMail(fromwho,towho,subject,body)
dim mymail
set mymail=server.createobject("CDONTS.Newmail")
Mymail.From=FromWho
Mymail.To=Towho
Mymail.Subject=Subject
MyMail.Body=body
'Mymail.AttachFile thispage "source"
Mymail.cc="d@d.com" '抄送
Mymail.bcc="a@a.com;b@b.com;c@c.com" '密送
Mymail.Sendset
set Mymail=NOthing
end sub

'FromWho=trim(reauest.form("fromWho"))
'...
'...
'If towho<>"" then
' SendMail fromwho,towho,subject,body
'end If

6.Ado 主要对象
1 Connection:
2 Command
3 Recordset
4 Error
5 Parameter
6 Property
7 Field

SET CONN=SERVER.CREATEOBJECT("ADODB.CONNECTION")
'SET RS=SERVER.CREATEOBJECT("ADODB.RECORDSET")
'SET COMM=SERVER.CREATEOBJECT("ADODB.COMMAND")
CONN.OPEN "DSN=HELLO"
SET RS=CONN.EXECUTE(SQLLANGUAGE) ' n,n | 1,3

WHILE RS.EOF
RS.MOVENEXT
RS.MOVEFIRST
RS.MOVELAST
RS.MOVEPREVIOUS
RS.MOVE NUMBER
WEND
'RS.move,RS.BOF RS.EOF
'RS.RecordCount RS.PageCount RS.PageSize RS.MaxRecords
'RS.AbsolutePage
.RS.CursorLocation=3 RS.AbsolutePosition [位置顺序号] 要配合使用
'rs("fieldname") rs(Number) rs.Fields("fieldname") rs.Fields(Number)
'Rs.Fields.Item("fieldname") Rs.Fields.item(Number)

关于Connection 与 Command
Set Conn=Server.CreateObject("Adodb.Connection")
Set MyCommand=server.createObject("Adodb.Command")
Conn.open "DSN=Hello"
Set Mycommand.activeConnection=Conn
Mycommand.CommandType=adCMDText
Mycommand.CommandText="select * from tablename"
set Rs=Mycommand.Execute()
Rs.close
conn.close
关于 RecordSet 与 Command
Set Conn=Server.CreateObject("Adodb.Connection")
Set MyCommand=server.createObject("Adodb.Command")
SET RS=SERVER.CREATEOBJECT("ADODB.RECORDSET")
Conn.open "DSN=Hello"
Set Mycommand.activeConnection=Conn
Mycommand.CommandType=adCMDText
Mycommand.CommandText="select * from tablename"
Rs.open Mycommand,adOpenStatic,adLockOptimstic
Rs.close
conn.close

COMMAND 带参数存储过程


不用DSN访问数据源
Connection to Access:
" Driver={Microsoft Access Driver (*.mdb)} ;DBQ="& server.mappath("aa.mdb")&"uid=;pwd=;"
Connection to Vfp:
DBC

DBF
Connection to SQL:
" Driver={Sql Server};Server=carl2; DataBase=pubs; uid=sa;pwd=;"
Connection to ORCale:
" Driver={Microsoft ODBC for Orcale};server=OrcaleServer.world; uid=demo;pwd=demo;"

该文章在 2013/11/28 11:43:01 编辑过
关键字查询
相关文章
正在查询...
点晴ERP是一款针对中小制造业的专业生产管理软件系统,系统成熟度和易用性得到了国内大量中小企业的青睐。
点晴PMS码头管理系统主要针对港口码头集装箱与散货日常运作、调度、堆场、车队、财务费用、相关报表等业务管理,结合码头的业务特点,围绕调度、堆场作业而开发的。集技术的先进性、管理的有效性于一体,是物流码头及其他港口类企业的高效ERP管理信息系统。
点晴WMS仓储管理系统提供了货物产品管理,销售管理,采购管理,仓储管理,仓库管理,保质期管理,货位管理,库位管理,生产管理,WMS管理系统,标签打印,条形码,二维码管理,批号管理软件。
点晴免费OA是一款软件和通用服务都免费,不限功能、不限时间、不限用户的免费OA协同办公管理系统。
Copyright 2010-2024 ClickSun All Rights Reserved