ADD.ASP
<!--#include file="../conn.asp"-->
<%
id=session("ljid")
lettertype=Trim(request.form("lettertype"))
letternum=Trim(request.form("letternum"))
pubdept=Trim(request.form("pubdept"))
letterdesc=Trim(request.form("letterdesc"))
sql="exec emp_addzs "&id&",'"&lettertype&"','"&letternum&"','"&pubdept&"','"&letterdesc&"'"
Set res = conn.execute(sql)
response.addheader"refresh","0;url=Empaddzs.asp"
set res = nothing
set conn = Nothing
%>
PIC.ASP
<!-- #include file="..\conn.asp"-->
<%
response.buffer=true
formsize=request.totalbytes
formdata=request.binaryread(formsize)
bncrlf=chrb(13)&chrb(10)
divider=leftb(formdata,clng(instrb(formdata,bncrlf))-1)
datastart=instrb(formdata,bncrlf&bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
mydata=midb(formdata,datastart,dataend)
res.open "SELECT * FROM letter where id is null",conn,1,3
res.addnew
res("letterpic").appendchunk mydata
res.update
'response.write session("Image_id")
'response.End
res.close
conn.close
Set res=nothing
Set conn=nothing
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
alert("上传成功!窗口将自动关闭!")
window.close()
//-->
</SCRIPT>
这样可以存入图片,但是无法与同一页面的其他字段值存入一条记录里.