“錯(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行,原來代碼為:
代碼如下:
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í),原來的代碼在后面再調(diào)用該標(biāo)簽時(shí)會(huì)不斷累加 sperstr值,造成該標(biāo)簽數(shù)量越多,后面的sql查詢字段,而access數(shù)據(jù)庫(kù),單表最多255個(gè)字段,sql查詢里面一次查詢也最多不超過255個(gè)字段,當(dāng)累加的字段數(shù)超過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ò)誤 。
更多信息請(qǐng)查看IT技術(shù)專欄