当前位置: 代码迷 >> ASP >> 关于错 误 号:5异常描述:Invalid procedure call or argument
  详细解决方案

关于错 误 号:5异常描述:Invalid procedure call or argument

热度:755   发布时间:2012-04-12 15:46:35.0
关于错 误 号:5错误描述:Invalid procedure call or argument
以下代码部分数据写操作没有问题,少部分数据操作时出错上面的错误,我对数据进行对比时出没有看出正常和出错的数据之间的区别。

有在网上看到有人讲是中文和英文服务器的问题,我测试后确实发现,出错的数据是由于服务器的不同造成的,请问有什么办法可以解决?
VBScript code


Response.Charset="gb2313"
adminarray=session("permission")
sqlstr=session("sqlstr")
mainkey=request("mainkey")
modkey=request("modkey")
Set fs=server.CreateObject("scripting.filesystemobject") 
newname="sales_date_export_"&year(date())&month(date())&day(date())&hour(time())&Minute(time())&second(time())&".xls"
filepath="excel\"&newname
filename=Server.MapPath(filepath) 
if fs.FileExists(filename) then fs.DeleteFile(filename) end if 
set myfile=fs.CreateTextFile(filename,true) 

    selectid=request("selectid")
    if selectid="" then 
        response.write "<script>alert('Error,Can't found record');self.close();</script>"
        response.end
    end if 
    mainkey=mid(mainkey,1,len(mainkey)-1)
    selectid=mid(selectid,1,len(selectid)-1)
    sqlstr="select * from salesview where id in ("&selectid&")"
    set rs=conn.execute (sqlstr,0,1)
    mainarr=split(mainkey,",")
    strLine="" 

    for i=0 to ubound(mainarr) 

                    sqlstr="select exportname from permissionlist where permissionfield='"&mainarr(i)&"'"
                    set temprs=conn.execute (sqlstr,0,1)
                    if not temprs.eof and not temprs.bof then 
                        strline=strline&temprs("exportname")&chr(9) 
                    else
                        strline=strline&mainarr(i)&chr(9) 
                    end if
                    set temprs=nothing         
    next
    myfile.writeline strLine

    do while not rs.eof
        strline=""
        for i=0 to ubound(mainarr)
            if mainarr(i)="pricevar" then 
                tempstr="rsfields=rs(""pricevarchar"")"
            else
                tempstr="rsfields=rs("""&mainarr(i)&""")"
            end if
            execute tempstr
            strline=strline&rsfields&chr(9)

        next
        myfile.writeline strLine 
        '这里是出错位置的语句。
         rs.movenext
    loop
set rs=nothing 
conn.close 
set conn=nothing 
set myfile=nothing 
Set fs=Nothing

if err then 
    
    response.write "<script>alert('Error,Pls Check your selected"&err.number&"');self.close()</script>"
    response.end
else
    response.write "<a href='"&filepath&"'>pls,right hit save as to download your export file:"&newname&" </a>"
    response.end
end if 



------解决方案--------------------
在服务器上安装最新版本的脚本引擎
  相关解决方案