不使用组件实现多个图片与文本数据同时写入数据库(2)
发表于:2007-06-30来源:作者:点击数:
标签:
‘’filename: add.asp ‘’--------------------------------------------------------------------------- ------------------------------------ !--#INCLUDE FILE=upload.inc-- % if session(IsPass)=1 then Dim FormData,FormSize FormSize=Request.Tota
‘’filename: add.asp
‘’---------------------------------------------------------------------------
------------------------------------
<!--#INCLUDE FILE="upload.inc"-->
<%
if session("IsPass")=1 then
Dim FormData,FormSize
FormSize=Request.TotalBytes
FormData=Request.BinaryRead(FormSize)
Set Fields = GetUpload(FormData)
set conn=server.CreateObject("ADODB.Connection")
conn.Open "driver={
SQL
Server};server=ServerIP;uid=Username;pwd=PassWord;database=DataBaseName"
set rec=server.createobject("ADODB.recordset")
on error resume next
rec.Open "SELECT * FROM xl",conn,1,3
on error resume next
rec.addnew
rec("ptype")=Fields("ptype").Value
rec("pname")=Fields("pname").Value
rec("pname1")=Fields("pname1").Value
rec("skill")=1
if Fields("img1").Value<>"" then
rec("img1").appendchunk Fields("img1").Value
end if
if Fields("img2").Value<>"" then
rec("img2").appendchunk Fields("img2").Value
end if
rec.update
rec.close
set rec=nothing
conn.close
set conn=nothing
response.redirect "pinput.asp"
else
response.redirect "index.htm"
end if
%>
原文转自:http://www.ltesting.net