不使用组件实现多个图片与文本数据同时写入数据库(2)

80酷酷网    80kuku.com

  数据|数据库'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
%>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: