錯(cuò)誤號(hào):3704 錯(cuò)誤描述:對(duì)象關(guān)閉時(shí),不允許操作

字號(hào):


    “錯(cuò)誤號(hào):3704 錯(cuò)誤描述:對(duì)象關(guān)閉時(shí),不允許操作。sql=select top 10 ContentID,a.SortID,a.GroupID,a.Exc.......”
    inc/AspCms_MainClass.asp文件,大約900行,原來(lái)代碼為:
    代碼如下:
    if str="content" or str="news" or str="product" or str="down" or str="pic" then
    sperStrs =conn.Exec("select SpecCategory+'_'+SpecField from {prefix}SpecSet Order by SpecOrder Asc,SpecID", "arr")
    if isarray(sperStrs) then
    for each spec in sperStrs
    sperStr = sperStr&","&spec
    next
    end if
    我們修改為:
    代碼如下:
    if str="content" or str="news" or str="product" or str="down" or str="pic" then
    sperStrs =conn.Exec("select SpecCategory+'_'+SpecField from {prefix}SpecSet Order by SpecOrder Asc,SpecID", "arr")
    if isarray(sperStrs) then
    sperStr=""
    for each spec in sperStrs
    sperStr = sperStr&","&spec
    next
    end if
    因?yàn)槌绦蛟谕粋€(gè)頁(yè)面循環(huán){aspcms:content}標(biāo)簽時(shí),原來(lái)的代碼在后面再調(diào)用該標(biāo)簽時(shí)會(huì)不斷累加 sperStr值,造成該標(biāo)簽數(shù)量越多,后面的SQL查詢字段,而Access數(shù)據(jù)庫(kù),單表最多255個(gè)字段,SQL查詢里面一次查詢也最多不超過(guò)255個(gè)字段,當(dāng)累加的字段數(shù)超過(guò)255個(gè)時(shí),運(yùn)行程序就會(huì)出錯(cuò)。此時(shí),會(huì)引起inc/AspCms_MainClass.asp文件,大約152行的程序代碼,內(nèi)容是:
    代碼如下:
    If Not DebugMode Then
    if Err then
    errid=Err.number:errdes=Err.description:Err.Clear:dbConn.close:set dbConn=nothing:isConnect=false
    echoErr err_03,errid,errdes&"sql="&sqlStr
    end if
    end if
    如果有錯(cuò)誤,程序代碼會(huì)關(guān)閉數(shù)據(jù)。于是就出現(xiàn)了前文的錯(cuò)誤 。