| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 637 人关注过本帖
标题:求教!BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除
只看楼主 加入收藏
koohik
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-10-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
求教!BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除
下面的是文件的源码,大家帮忙看一看,谢谢了
<!-- #include file="../../include/webconfig.asp" -->
<!-- #include file="../../include/check-session.asp" -->
<!-- #include file="../../include/conn.asp" -->
<!-- #include file="../../include/function.asp" -->
<!-- #include file="../../include/upload.asp" -->
<!-- #include file="../../include/LG.InfoCls.asp" -->
<%
Dim upload
Set upload = New DoteyUpload    '建立文件上传对象
upload.Upload()                    '分析上传的数据,并保存到相应的集合中

'创建类
Dim objInfoCls
Set objInfoCls = new InfoCls

Dim sAction            '当前操作类型
Dim Rs
Dim sSQL
Dim iID
Dim sTitle            '标题
Dim sImage            '图片
Dim iInfoType        '类别
Dim sTypeURL        '类别URL
Dim sKeyword        '关键字
Dim sSource            '资讯来源
Dim sSender            '责任编辑
Dim iClick            '点击率
Dim iGood            '有用总数
Dim iBad            '没用总数
Dim iCommend        '是否推荐
Dim iTop            '是否置顶
Dim iHead            '是否头条
Dim iSlide            '是否幻灯   
Dim sDetail            '内容
Dim iPageWordCount    '分页字数
Dim sCreateInfo        'HTML生成是否成功信息

Dim sFormQuery
Dim iInfoState        '资讯状态
Dim iQueryInfoType    '查询类别
Dim sQueryValue        '查询标题
Dim sQueryBeginTime    '新增开始时间
Dim sQueryEndTime    '新增结束时间
Dim iQueryCommend    '推荐
Dim iQueryTop        '置顶
Dim iQueryHead        '头条
Dim iQuerySlide        '幻灯
Dim iPage
'****** 修改后分页定位的参数传递 ******
sFormQuery = UCase(upload.Form("FormQuery"))
iInfoState = upload.Form("state")
iPage = upload.Form("page")
If sFormQuery = "Y" Then
    iQueryInfoType    = upload.Form("QueryInfoType")
    sQueryValue        = upload.Form("QueryValue")
    sQueryBeginTime    = upload.Form("QueryBeginTime")
    sQueryEndTime    = upload.Form("QueryEndTime")
    iQueryCommend    = upload.Form("QueryCommend")
    iQueryTop        = upload.Form("QueryTop")
    iQueryHead        = upload.Form("QueryHead")
    iQuerySlide        = upload.Form("QuerySlide")
End If
'****** end 修改后分页定位的参数传递 ******

sAction            = LCase(upload.Form("action"))
iID                = upload.Form("ID")
sTitle            = upload.Form("Title")
sImage            = upload.Form("Image")
iInfoType        = upload.Form("InfoType")
sKeyword        = upload.Form("Keyword")
sSource            = upload.Form("Source")
sSender            = upload.Form("Sender")
iClick            = upload.Form("Click")
iGood            = upload.Form("Good")
iBad            = upload.Form("Bad")
iCommend        = upload.Form("Commend")
iTop            = upload.Form("Top")
iHead            = upload.Form("Head")
iSlide            = upload.Form("Slide")
iPageWordCount    = upload.Form("PageWordCount")
sDetail            = upload.Form("Detail")

'格式处理
If sDetail = "" Then
    Set upload = Nothing
    Set objInfoCls = Nothing
    Call DisConn()
    Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert(""内容不能为空!"");window.location.href='add.asp';</script>")
    Response.End()
End If
iID                = DisposeNumeric(iID)
iInfoType        = DisposeNumeric(iInfoType)
iClick            = DisposeNumeric(iClick)
iGood            = DisposeNumeric(iGood)
iBad            = DisposeNumeric(iBad)
iCommend        = DisposeNumeric(iCommend)
iTop            = DisposeNumeric(iTop)
iHead            = DisposeNumeric(iHead)
iSlide            = DisposeNumeric(iSlide)
iPageWordCount    = DisposeNumeric(iPageWordCount)

'URL参数
Dim sURLParameter
sURLParameter = "?FormQuery=" & sFormQuery & "&amp;state=" & iInfoState & "&amp;QueryInfoType=" & iQueryInfoType & "&amp;QueryValue=" & Server.URLEncode(sQueryValue) & "&amp;QueryBeginTime=" & Server.URLEncode(sQueryBeginTime) & "&amp;QueryEndTime=" & Server.URLEncode(sQueryEndTime) & "&amp;QueryCommend=" & iQueryCommend & "&amp;QueryTop=" & iQueryTop & "&amp;QuerySlide=" & iQuerySlide & "&amp;page=" & iPage


'头条信息只有一笔(取消之前的头条信息)
If iHead = 1 Then
    sSQL = "UPDATE tbInfo SET Info_Head=0 WHERE Info_Head=1 AND Info_ID<>" & iID
    Conn.Execute(sSQL)
End If

Set Rs = Server.CreateObject("ADODB.Recordset")
Select Case sAction
    Case "add"        '新增
        '查找是否已经发布过该标题的资讯
        sSQL = "SELECT * FROM tbInfo WHERE Info_Title='" & Replace(sTitle, "'", "''") & "'"
        Rs.Open sSQL, Conn, 1, 3
        If Not Rs.Eof Then
            Set upload = Nothing
            Set objInfoCls = Nothing
            Rs.Close()
            Set Rs = Nothing
            Call DisConn()
            Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('已经存在“" & sTitle & "”标题的资讯!');window.location.href='add.asp';</script>")
            Response.End()
        Else
            Rs.AddNew()
            Rs("Info_State")    = 1
            Rs("Info_AddTime")    = Now()
        End If
    Case "save"        '修改
        sSQL = "SELECT * FROM tbInfo WHERE Info_ID=" & iID
        Rs.Open sSQL, Conn, 1, 3
        If Rs.Eof Then
            Set upload = Nothing
            Set objInfoCls = Nothing
            Rs.Close()
            Set Rs = Nothing
            Call DisConn()
            Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('该资讯不存在或已被删除,请确认!');window.location.href='list.asp" & sURLParameter & "';</script>")
            Response.End()
        Else
            Dim Rs_Operate
            Set Rs_Operate = Server.CreateObject("ADODB.Recordset")
            '查找是否已经发布过该标题的资讯
            sSQL = "SELECT Info_ID FROM tbInfo WHERE Info_Title='" & Replace(sTitle, "'", "''") & "' AND Info_ID<>" & iID
            Rs_Operate.Open sSQL, Conn, 1, 1
            If Not Rs_Operate.Eof Then
                Rs_Operate.Close()
                Set Rs_Operate = Nothing
                Set upload = Nothing
                Set objInfoCls = Nothing
                Rs.Close()
                Set Rs = Nothing
                Call DisConn()
                Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('已经存在“" & sTitle & "”标题的资讯!');window.location.href='update.asp" & sURLParameter & "';</script>")
                Response.End()
            End If
            Rs_Operate.Close()
            Set Rs_Operate = Nothing
        End If
    Case Else
        Set upload = Nothing
        Set objInfoCls = Nothing
        Rs.Close()
        Set Rs = Nothing
        Call DisConn()
        sResponse = "<script type=""text/javascript"" charset=""utf-8"">alert('无效的操作!');window.location.href='list.asp" & sURLParameter & "';</script>" & Chr(13) & Chr(10)
        Response.End()
End Select

'判断是否有上传文件
If IsObject(upload.Files("Image")) Then
    Dim objFSO
    Dim file
    Dim sFilePath        '文件绝对路径
    Dim sOppositePath    '文件相对路径
    Dim sFileType        '文件类型
    Dim iFileSize        '文件大小
    Dim sFileName        '文件名
    Dim sFileExt        '文件扩展名

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    Set file = upload.Files("Image")    '生成一个文件对象
    sFileType    = file.FileType            '文件类型
    iFileSize    = file.FileSize/1024    '文件大小(KB)
    sFileExt    = file.FileExt            '文件扩展名
    sFileExt    = FixName(sFileExt)        '过滤一些扩展名文件

    '限制文件上传大小
    If iFileSize > iAppImageSize Then
        Set file = Nothing
        Set objFSO = Nothing
        Set upload = Nothing
        Set objInfoCls = Nothing
        Rs.Close()
        Set Rs = Nothing
        Call DisConn()
        If sAction = "add" Then
            Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert(""上传图片不能超过" & iAppImageSize & "KB,请改变图片大小后重新上传!"");window.location.href='add.asp';</script>")
        Else
            Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert(""上传图片不能超过" & iAppImageSize & "KB,请改变图片大小后重新上传!"");window.location.href='update.asp" & sURLParameter & "';</script>")
        End If
        Response.End()
    End If

    '限制文件上传类型为gif|jpg|jpeg|bmp|png 图象文件
    If Not (CheckFileExt(sFileExt) And CheckFileType(sFileType)) Then
        Set file = Nothing
        Set objFSO = Nothing
        Set upload = Nothing
        Set objInfoCls = Nothing
        Rs.Close()
        Set Rs = Nothing
        Call DisConn()
        If sAction = "add" Then
            Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert(""上传图片只支持 gif|jpg|jpeg|bmp|png 图象文件!"");window.location.href='add.asp';</script>")
        Else
            Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert(""上传图片只支持 gif|jpg|jpeg|bmp|png 图象文件!"");window.location.href='update.asp" & sURLParameter & "';</script>")
        End If
        Response.End()
    End If

    '创建该路径中不存在目录
    sOppositePath = sAppRootPath & "uploadfile/info/"
    CheckFolderDir(sOppositePath)
   
    '获取文件路径
    sOppositePath = sOppositePath & MakeFileName() & "." & sFileExt    '数据库存取路径
    sFilePath = Server.MapPath(sOppositePath)    '保存文件路径

    '旧图片处理
    Dim sOldPicture
    sOldPicture = DisposeNull(Rs("Info_Image"))
    If sOldPicture <> "" Then
        sOldPicture = Server.MapPath(sOldPicture)    '获取绝对路径
        If objFSO.FileExists(sOldPicture) Then objFSO.DeleteFile sOldPicture, True
    End If

    If objFSO.FileExists(sFilePath) Then objFSO.DeleteFile sFilePath,True    '删除图片
    upload.SaveTo(sFilePath)  '保存图片

    Rs("Info_Image") = sOppositePath

    Set file = Nothing
    Set objFSO = Nothing

    If Err Then
        Set upload = Nothing
        Set objInfoCls = Nothing
        Rs.Close()
        Set Rs = Nothing
        Call DisConn()
        Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('" & Err.Description & "');window.location.href='list.asp" & sURLParameter & "';</script>")
        Response.End()
    End If
End If

'sDetail = DisposeArticleContent(sDetail)    '文章内容处理

'保存数据
Rs("Info_TypeID")            = iInfoType
Rs("Info_Title")            = sTitle
Rs("Info_Keyword")            = sKeyword
Rs("Info_Detail")            = sDetail
Rs("Info_Source")            = sSource
Rs("Info_Sender")            = sSender
Rs("Info_Click")            = iClick
Rs("Info_Good")                = iGood
Rs("Info_Bad")                = iBad
Rs("Info_Commend")            = iCommend
Rs("Info_Top")                = iTop
Rs("Info_Head")                = iHead
Rs("Info_Slide")            = iSlide
Rs("Info_PageWordCount")    = iPageWordCount
Rs.Update()
Rs.Close()

If Err Then
    Set upload = Nothing
    Set objInfoCls = Nothing
    Set Rs = Nothing
    Call DisConn()
    Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('" & Err.Description & "');window.location.href='list.asp" & sURLParameter & "';</script>")
    Response.End()
End If

'判断是否需要生成静态HTML
If bAppCreateHTML Then
    '获取需要生成的资讯ID
    Dim iCreateID
    iCreateID = iID
    If iCreateID = 0 Then
        iCreateID = objInfoCls.GetMaxInfoID()
    End If

    '获取静态HTML生成路径配置信息
    Dim sSourcePath        '动态源文件路径
    Dim sSavePath        '静态页面生成路径
    Dim sWebURL            '网站地址
    Dim bCreate            '是否生成成功
    '判断是否存在静态HTML生成配置信息
    sSQL = "SELECT CreateHTML_SourcePath,CreateHTML_SavePath FROM tbCreateHTML WHERE CreateHTML_Name='资讯详细页生成'"
    Rs.Open sSQL, Conn, 1, 1
    If Not Rs.Eof Then
        sSourcePath    = DisposeNull(Rs("CreateHTML_SourcePath"))
        sSavePath    = DisposeNull(Rs("CreateHTML_SavePath"))

        '网站地址
        If sAppWebURL = "" Then
            sWebURL = GetServerName()
        Else
            If Right(sAppWebURL, 1) = "/" Then
                sWebURL = Left(sAppWebURL, Len(sAppWebURL)-1)
            Else
                sWebURL = sAppWebURL
            End If
        End If

        '源文件路径处理
        sSourcePath = sWebURL & LCase(sSourcePath)
        sSourcePath = Replace(sSourcePath, "{$approotpath$}", sAppRootPath)
        sSourcePath = Replace(sSourcePath, "{$appadminpath$}", sAppAdminPath)
        sSourcePath = Replace(sSourcePath, "{$appfileformat$}", sAppFileFormat)
        sSourcePath = Replace(sSourcePath, "{$id$}", iCreateID)

        '生成文件路径处理
        If sSavePath <> "" Then
            sSavePath = LCase(sSavePath)
            sSavePath = Replace(sSavePath, "{$approotpath$}", sAppRootPath)
            sSavePath = Replace(sSavePath, "{$appadminpath$}", sAppAdminPath)
            sSavePath = Replace(sSavePath, "{$appfileformat$}", sAppFileFormat)
            sSavePath = Replace(sSavePath, "{$id$}", iCreateID)
        Else
            '获取类别URL链接
            sTypeURL = ""
            Call objInfoCls.GetTypeURL(iInfoType, sTypeURL)

            If Right(sAppRootPath, 1) = "/" Then
                sSavePath = Left(sAppRootPath, Len(sAppRootPath)-1) & sTypeURL & iCreateID & "/index" & sAppFileFormat
            Else
                sSavePath = sAppRootPath & sTypeURL & iCreateID & "/index" & sAppFileFormat
            End If
        End If

        '判断目录是否存在,不存在则创建
        Dim iPlace
        Dim sFolderPath
        iPlace = InStr(sSavePath, "/")
        sFolderPath = Left(sSavePath, iPlace-1)
        Call CheckFolderDir(sFolderPath)

        '判断生成目录是否存在,不存在则创建
        iPlace = InStrRev(sSavePath, "/")
        sFolderPath = Left(sSavePath, iPlace)
        If Not CheckFolderDir(sFolderPath) Then
            sCreateInfo = "\n\n" & sFolderPath & "目录创建失败!"
        Else
            If iPageWordCount <> 0 Then
                '********** 长内容文章分页 **********
                Dim iCurPage            '当前页码
                Dim iPageNum            '总页数
                Dim sPageSourcePath        '当前页需生成URL地址
                Dim sPageSaveURL        '当前页生成后URL地址
                Dim sArrPageDetail        '页面内容数组
                If iPageWordCount = -1 Then
                    '为避免和文章内容相连出现错误,用Replace函数把分页代码“{$分页$}”的前后各加一个全角的"空格"
                    sDetail = Replace(sDetail, "{$分页$}", " {$分页$} ")
                    '使用函数Splist取出分段存入sArrPageDetail中
                    sArrPageDetail = Split(sDetail, "{$分页$}")
                    '总页数
                    iPageNum = UBound(sArrPageDetail)
                Else
                    '去除分页标签
                    sDetail = Replace(sDetail, "{$分页$}", "")
                    '总页数
                    iPageNum = Int(Len(sDetail) / (iPageWordCount + 0.0001))  '总页数
                End If
                '循环生成详细内容分页页面
                For iCurPage = 0 To iPageNum
                    sPageSourcePath    = sSourcePath & "&page=" & iCurPage
                    If iCurPage <> 0 Then
                        sPageSaveURL = Replace(sSavePath, sAppFileFormat, "_" & iCurPage & sAppFileFormat, 1, -1, 1)
                    Else
                        sPageSaveURL = sSavePath
                    End If
                    '创建静态HTML文件
                    bCreate = CreateHTML(sPageSourcePath, sPageSaveURL)
                Next
                '********** end 长内容文章分页 **********
            Else
                '创建静态HTML文件
                bCreate = CreateHTML(sSourcePath, sSavePath)
            End If
            '更新数据库中HTML路径
            If bCreate Then
                sSQL = "UPDATE tbInfo SET Info_HTMLPath='" & sFolderPath & "' WHERE Info_ID=" & iCreateID
                Conn.Execute(sSQL)

                If Err Then
                    Set upload = Nothing
                    Set objInfoCls = Nothing
                    Call DisConn()
                    Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('静态HTML路径更新失败!\n失败原因:" & Err.Description & "');window.location.href='list.asp" & sURLParameter & "';</script>")
                    Response.End()
                End If
            Else
                sCreateInfo = "\n\n静态HTML生成失败!\n失败原因:" & Err.Description
            End If
        End If
    Else
        sCreateInfo = "\n\n静态HTML生成失败!请先到“HTML生成管理”里进行设置!"
    End If
    Rs.Close()
End If

'释放资源
Set Rs = Nothing
Set upload = Nothing
Set objInfoCls = Nothing
Call DisConn()

If sAction = "add" Then
    Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('资讯新增成功!" & sCreateInfo & "');window.location.href='add.asp';</script>")
ElseIf sAction = "save" Then
    Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('资讯更新成功!" & sCreateInfo & "');window.location.href='list.asp" & sURLParameter & "';</script>")
Else
    Response.Write("<script type=""text/javascript"" charset=""utf-8"">alert('资讯更新失败!');window.location.href='list.asp" & sURLParameter & "';</script>")
End If
%>
搜索更多相关主题的帖子: BOF EOF 记录 删除 
2010-10-28 09:22
cnfarer
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:179
帖 子:3330
专家分:21157
注 册:2010-1-19
收藏
得分:20 
代码虽然很多,但没有包含文件,不能测试!另外到底是什么问题?

★★★★★为人民服务★★★★★
2010-10-30 20:21
快速回复:求教!BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.058759 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved