一、文件操作 total=Request.TotalBytes '包括文件的总字节 set f=createobject("adodb.stream") f.Type=1 '1 binary type,2 text type f.mode=3 '1 only read,2 only write,3 read and write f.Open f.write(Request.BinaryRead(total)) '二进制写进f里面 f.Position=0 bf=f.read 'binary read into bf f.write(binary code) f.Type=2 'text type f.CharSet="GB2312" 'ascii or GB2312 tf=f.readtext 'text read into tf f.writetext("Content-Type:") '文本文件写进f里面 f.Close set f=Nothing f.SaveToFile(server.mappath("/file.txt"),2) '保存到相对目录文件名为file.txt,可覆盖 f.CopyTo(binf,length) '从f中复制length长度到binf f.write Request.BinaryRead(size) '二进制写进a里面 二、字符操作 处理文件内容字符集用字符集处理,二进制内容用二进制处理 int instr(position,textsrc,sign) '返回从position到遇到sign的字符串内容位置 int instrb(position,textsrc,sign) '返回从position到遇到sign的二进制内容位置 string mid("1234567890",4,5) '返回文本56789 string midb(binary file,start position,length) '返回二进制 string left("1234567890",6) '返回123456 string right("1234567890",6) '返回567890 string[] = split(source,sign) '返回字符串数组 Response.BinaryWrite(binary data) '响应二进制数据 三、数据库 Set connweb = Server.CreateObject("ADODB.Connection") connweb.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("dbweb.mdb") sqlcmd="INSERT INTO CliTrace (name_,value_,when_)VALUES('"&admin&"','"&netaddr&"','"&isnow&"')" connweb.execute(sqlcmd) sqlcmd="select * from WebCurrent" set rs=server.createobject("adodb.recordset") rs.open sqlcmd,connweb,1,3 rs.addnew rs("summery_")=summery rs.update rs.close() set rs=nothing connweb.close