1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

asp+sq读图片问题,请几位大哥帮忙

本帖由 prolover2005-11-22 发布。版面名称:后端开发

  1. prolover

    prolover New Member

    注册:
    2005-10-10
    帖子:
    20
    赞:
    0
    我找了个asp上传和读取图片的程序,修改了一下,想自己用,可水平太低,
    show.asp(读取显示图片的文件)报错
    Microsoft VBScript 编译器错误 错误 '800a03f6'

    缺少 'End'

    /iisHelp/common/500-100.asp,行242

    Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'

    ODBC 驱动程序不支持所需的属性。

    /nyjcy/show.asp,行11

    代码如下:

    <%
    set connGraph=server.CreateObject("ADODB.connection")
    connGraph.ConnectionString="Driver={sql server};server=prolover;database=ejubao;uid=sa;pwd=;"
    connGraph.Open
    set rec=server.createobject("ADODB.recordset")
    strsql="select img from images where id=" & trim(request("id"))
    'strsql="select img from images where id=1"
    rec.open strsql,connGraph,1,1
    Response.ContentType = "image/*"
    Response.BinaryWrite rec("img").getChunk(7500000)
    rec.close
    set rec=nothing
    set connGraph=nothing
    %>
    到底是咋了?!
     
  2. Tameway

    Tameway New Member

    注册:
    2005-09-06
    帖子:
    1,286
    赞:
    8
    因为程序中缺少End
    前面出现if …… then
    后面却没有end if来结束
    可以自己找找这个end if应该加在哪里?加上去就可以了
     
  3. 吴天

    吴天 New Member

    注册:
    2005-09-08
    帖子:
    16
    赞:
    0
    这样写试试呢?
    <%
    set connGraph=server.CreateObject("ADODB.connection")
    connGraph.ConnectionString="Driver={sql server};server=prolover;database=ejubao;uid=sa;pwd=;"
    connGraph.Open
    set rec=server.createobject("ADODB.recordset")
    if request("id")<>"" then
    strsql="select img from images where id=" &request("id")
    rec.open strsql,connGraph,1,1
    if not rec.eof then
    Response.ContentType = "image/*"
    Response.BinaryWrite rec("img").getChunk(7500000)
    end if
    rec.close
    set rec=nothing
    set connGraph=nothing
    end if
    %>
     
  4. prolover

    prolover New Member

    注册:
    2005-10-10
    帖子:
    20
    赞:
    0
    我明白了

    我又加了一个response.clear就可以了!