在upload.asp页面发生错误,其提示如下:(upload页面有一个num参数是从all.asp页面传过来的,请大家看看问题是不是出在这里)
错误类型:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
第 1 行: '=' 附近有语法错误。
/fenqiu/up/upload.asp, 第 33 行浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) 网页:
POST 11801 ??? /fenqiu/up/upload.aspPOST Data:
错误 '80020009' 
发生意外。 /iisHelp/common/500-100.asp,行 219 
upload.htm源码如下:
<form action="upload.asp?num="  enctype="multipart/form-data"   method="post"  name="form1" target="_self">
    <table width="500" border="0" cellpadding="0" cellspacing="0" class="text">
      <tr> 
        <td height="26" bgcolor="#0099FF"> <div align="center"> 
            <p class="tit">图片上传</p>
          </div></td>
      </tr>
      <tr> 
        <td height="48"> <div align="center">请先选择您要上传的照片!<br/>
            <font color="#FF0000">(只能是*.gif、*.jpg、*.bmp)</font></div></td>
      </tr>
      <tr> 
        <td height="34"> <div align="center"> 
            <input name="pic" type="file" id="pic">
          </div></td>
      </tr>
    </table></form>
<form action="all.asp"  method="post"  name="fr" target="sub2" id="fr">
    
  <table width="500" border="0" cellpadding="0" cellspacing="0" class="text">
    <tr> 
      <td height="25" colspan="2"> <div align="center">请填写下边所有项目!</div></td>
    </tr>
    <tr> 
      <td width="242"><div align="center">上传者姓名:</div></td>
      <td width="256" height="26"> <div align="left"> 
          <input name="userid" type="text" id="userid">
        </div></td>
    </tr>
    <tr> 
      <td><div align="center">照片名字:</div></td>
      <td height="26"> <div align="left"> 
          <input name="tname" type="text" id="tname">
        </div></td>
    </tr>
    <tr> 
      <td><div align="center">照片说明:</div></td>
      <td height="28"> <div align="left"> 
          <input name="ttext" type="text" id="ttext">
        </div></td>
    </tr>
    <tr> 
      <td><div align="center">照片宽度:</div></td>
      <td height="28"><input name="pw" type="text" id="pw"></td>
    </tr>
    <tr> 
      <td><div align="center">照片高度:</div></td>
      <td height="28"><input name="ph" type="text" id="ph"></td>
    </tr>
    <tr> 
      <td height="18" colspan="2"><div align="center"></div>
        <div align="center"> 
          <input type="submit" name="Submit2" value="提交">
        </div></td>
    </tr>
  </table>
  </form>
<!--呵呵~~,下边这个iframe可是这个小把戏的重要角色!-->
<iframe frameborder="0" width="0" height="0" scrolling="no" src="../int.htm" name="sub2" ></iframe>
</body>
</html>upload.asp源码如下:
<%
Function StringToBinary(String)
 response.write string
    Dim i, b
    For i=1 to len(String)
      b = b & ChrB(Asc(Mid(String,i,1)))
    Next 
    StringToBinary = b
  End Function
  Dim Conn,connstr
  Set conn = Server.Createobject("adodb.connection") 
  connstr = "Provider = sqloledb;User ID=sa;Password=;Initial Catalog=fenqiu;Data Source=(local)" 
  conn.open connstr
  data=Request.BinaryRead(request.TotalBytes)
  ct=Request.ServerVariables("HTTP_Content_Type")
  Boundary ="--"&Mid(ct, InStr(LCase(ct), "boundary=") + 9)
  str2=StringToBinary("image/bmp")
  start=instrb(data,str2)+13
  if start=13 then
    str2=StringToBinary("image/gif")
    start=instrb(data,str2)+13
  end if
  if start=13 then
    str2=StringToBinary("image/pjpeg")
    start=instrb(data,str2)+15
  end if
  str3=StringToBinary(Boundary)
  tend=instrb(10,data,str3)
  leng=tend-start
  rdata=midb(data,start,leng)
  sql="select * from tpic where num="&request.QueryString("num")
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,3,3
  rs("pic").appendchunk rdata
  rs.update
  rs.close
  set rs=nothing  
  conn.close
  set conn=nothing
  response.Write "数据添加完毕!该图片id号是:"&request.QueryString("num")
  %>all.asp源码如下:
<!--#include file="../conn.asp"--> 
<%
  sql="select * from tpic"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,3,3
  rs.addnew
  tnum=rs("num")
  rs("name")=request.Form("tname")
  rs("userid")=request.Form("userid")
  'session("user")
  rs("text")=request.Form("ttext")
  rs("pw")=request.Form("pw")
  rs("ph")=request.Form("ph")
  rs.update
  rs.close
  set rs=nothing  
  conn.close
  set conn=nothing
  %>
<!--提交上个页面中的图片上传表单!-->
 <body bgcolor="#000000" text="#339933" link="#33FF00" vlink="#666666" alink="#666600" onLoad="top.form1.action=top.form1.action+'<%=tnum%>';top.form1.submit()"></body>