解决方案 »

  1.   

    先判断Recordset1是否是EOF或者BOF再执行操作
      

  2.   

    Recordset1_cmd.CommandText = "SELECT * FROM Works WHERE WorksID = ?" 
    这个没有查出任何记录为什么用问号
      

  3.   


    这个是DW自动生成的语句,绑定记录集的时候生成的,
    筛选表中WorksID=URL参数 WorksID
      

  4.   


    这个语句要怎么写呢?我基本都是用DW自动生成的设定和修改别人的语句。。【惭愧】
    if Recordset1.eof or Recordset1.bof then
        '没有找到内容
    else
       '输出内容
    end if
      

  5.   


    这个语句要怎么写呢?我基本都是用DW自动生成的设定和修改别人的语句。。【惭愧】
    if Recordset1.eof or Recordset1.bof then
        '没有找到内容
    else
       '输出内容
    end if添加完了出现新的错误了VIMG那句错了。。
    由于我数据表的字段必须填写路径,不能只写图片名【在别的地方我还要调用路径】
    所以我重新写了一个读取字段中文件路径然后删除文件的,显示FSO语句有语法错误,可以的话请帮我看一下
    在此页绑定了数据集,筛选为WorksID=URL参数WorksID 之前用别人的代码时没绑定,总显示参数不足
    这个代码时我仿照别人的代码写的
    连接的是access2010的accdb数据库,用的VBS,DWCS6,IIS7.5,WIN7系统,
    数据表的字段内容是文本格式的存储路径,文件不一定是图片文件,基本是rar,flv,jepg,jpg
    路径字段是ViewPath和WorksPath,数据表是Works,
    如下
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!--#include file="Connections/conn.asp" -->
    <%
    Dim Recordset1__MMColParam
    Recordset1__MMColParam = "1"
    If (Request.QueryString("WorksID") <> "") Then 
      Recordset1__MMColParam = Request.QueryString("WorksID")
    End If
    %>
    <%
    Dim Recordset1
    Dim Recordset1_cmd
    Dim Recordset1_numRowsSet Recordset1_cmd = Server.CreateObject ("ADODB.Command")
    Recordset1_cmd.ActiveConnection = MM_conn_STRING
    Recordset1_cmd.CommandText = "SELECT * FROM Works WHERE WorksID = ?" 
    Recordset1_cmd.Prepared = true
    Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDoubleSet Recordset1 = Recordset1_cmd.Execute
    Recordset1_numRows = 0
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <%    upfile=Recordset1("ViewPath")
        upfile2=Recordset1("WorksPath")  
        dim fso :set fso=server.createobject("scripting.filesystemobject")
        if fso.fileexists(upfile) then 
        fso.deletefile &upfile 
        if fso.fileexists(upfile2)
        then fso.deletefile &upfile2 
        set fso=nothing    sql="delete * from works where WorksID='" & Request.Form("WorksID") & "'"if not err then
       response.write "删除成功!<a href=""index.asp"">返回列表</a>"
    else
       response.redirect "index.asp"
    end if
    %><body>
    </body>
    </html>
    <%
    Recordset1.Close()
    Set Recordset1 = Nothing
    %>