分享

写回答

发帖

[提问] 急急急!采集时出现Microsoft VBScript runtime error '800a0005'

GoDaddy GoDaddy 2758 人阅读 | 9 人回复

发表于 2010-8-2 13:35:04 | 显示全部楼层 |阅读模式

错误提示
Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument

/zhuyuping/web_admin/conn.asp, line 100


conn.asp代码:
<!--#include file="../data.asp"-->

<%
        Response.Buffer = True
        Response.ExpiresAbsolute = Now() - 1
        Response.Expires = 0
        Response.CacheC
        Response.AddHeader "ragma", "no-cache"
        Response.AddHeader "Cache-Control", "no-cache, must-revalidate"
'--------------------------------------------------------------------------
Dim rs,Conn,conn2
        

On Error Resume Next


        '主站数据联接
        set Conn=Server.CreateObject ("Adodb.Connection")
        Conn.Open "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath("../"&const_AccessDatabase&"")

        '采集数据联接
        set Conn2=Server.CreateObject ("Adodb.Connection")
        Conn2.Open "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath("../"&const_ZJDatabase&"")



'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查连接字符串。"
Response.End
End If
On Error GoTo 0

function strlogin(str)
if str="" or isnull(str) then
        strlogin=str
        exit function
end if
strlogin = replace(str,"&","")
strlogin = replace(strlogin,"%","")
strlogin = replace(strlogin,chr(34),"")
strlogin = replace(strlogin,"=","")
strlogin = replace(strlogin," ","")
strlogin = replace(strlogin,"<","")
strlogin = replace(strlogin,">","")
strlogin = replace(strlogin,"(","")
strlogin = replace(strlogin,")","")
end function

function utf8(str)
if str="" or isnull(str) then
        utf8=str
        exit function
end if
utf8 = replace(str,"&","&")
utf8 = replace(utf8,"",""")
utf8 = replace(utf8,"<","<")
utf8 = replace(utf8,">",">")
utf8 = replace(utf8," "," ")
utf8 = replace(utf8,"$","$$")
utf8 = replace(utf8,"'","'")
utf8 = replace(utf8,vbnewline,"<br/>")
end function


function CreateFolder(str)
dim UploadPath,Path,i,FSOObj
UploadPath=split(Replace(str,"\","/"),"/")
        Path = server.mappath(Request.ServerVariables("SCRIPT_NAME"))
        Path=left(Path,instrrev(Path,"\" ) - 1 )
        path=path & "/../"

        for i=0 to ubound(UploadPath)
        if UploadPath(i)<>"" then
        path=path & UploadPath(i) & "/"
            Set FsoObj=Server.CreateObject("Scripting.FileSystemObject")
        IF FSOObj.FolderExists(path) = False then
           FsoObj.CreateFolder(path)
        end if
        Set FsoObj=Nothing
        end if
        next

end function

function CreateFile(str,Filepath)
dim txt,Path,FSO,fout
        txt=Replace(trim(str),chr(13)&chr(10),vbNewLine)

        Path = server.mappath(Request.ServerVariables("SCRIPT_NAME"))
        Path=left(Path,instrrev(Path,"\" ) - 1 )
        path=path & "/../" & Filepath

        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        IF FSO.FileExists(path) = False then
        Set fout = fso.Createtextfile(path,true)
        fout.write txt        '不换行
        'fout.writeline txt        '换行
        fout.close
        set fout=nothing
        end if
        set fso=nothing

end function


function DelFile(Filepath)
dim Path,FSO

        Path = server.mappath(Request.ServerVariables("SCRIPT_NAME"))
        Path=left(Path,instrrev(Path,"\" ) - 1 )
        path=path & "/../" & Filepath

        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        IF FSO.FileExists(path) = True then
           Fso.deleteFile path,true
        end if
        set fso=nothing

end function

function DelFolder(Filepath)
dim Path,FSO

        Path = server.mappath(Request.ServerVariables("SCRIPT_NAME"))
        Path=left(Path,instrrev(Path,"\" ) - 1 )
        path=path & "/../" & Filepath


            Set FsoObj=Server.CreateObject("Scripting.FileSystemObject")
        IF FSOObj.FolderExists(path) = True then
           FsoObj.deleteFolder path,true
        end if
        Set FsoObj=Nothing


end function

%>
国外主机真郁闷啊。大家帮帮忙,先谢了!

[ 本帖最后由 北极末端 于 2010-8-2 01:48 PM 编辑 ]

回答|共 9 个

add.c

发表于 2010-8-2 13:58:32 | 显示全部楼层

解决方法--------------------------
1、 在所有包含asp代码的页面(即所有的*.asp文件)的第1行加入如下代码:<%@ codepage="936" %>
  如果第1行是<%@ LANGUAGE="VBscript" %>,则把第1行改为:<%@ codepage="936" LANGUAGE="VBscript" %>
  936是简体中文的代码页,可以保证asp动态生成的内容不变乱码。

2、 再次检查所有文件,确保在<head>和</head>之间有这样一句:
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  gb2312是简体中文的默认编码,这样能保证你页面的静态内容不变乱码

3、Set fout = fso.CreateTextFile(server.mappath("../flash/"&request("id")&".htm"),true,true)   
  第2参数设置为true表示以Unicode方式创建   
  如果还不行,顺便将这句改成这样试试fout.WriteLine pencat

北极末端

发表于 2010-8-2 14:38:15 | 显示全部楼层

回复 2# 的帖子

第三点貌似可行,但是我的该怎么改呢?

add.c

发表于 2010-8-2 15:00:57 | 显示全部楼层

Set fout = fso.Createtextfile(path,true,true)    ,        或者   Set fout = fso.Createtextfile(path,,true)
这样, 这个是网上搜到的, 你看看

北极末端

发表于 2010-8-2 15:20:05 | 显示全部楼层

回复 4# 的帖子

我的本来就是这样的啊!
晕死~~
等待高手!

add.c

发表于 2010-8-2 15:33:19 | 显示全部楼层

多了个参数, 之前有人的问题就是加个参数可以的. 另外你什么程序?

北极末端

发表于 2010-8-2 17:26:22 | 显示全部楼层

回复 6# 的帖子

我这个程序估计你没见过的
加一个true?
RAKSmart

北极末端

发表于 2010-8-2 20:25:00 | 显示全部楼层

有没有人啊!!

北极末端

发表于 2010-8-3 00:15:52 | 显示全部楼层

回复 4# 的帖子

谢谢,搞定了

add.c

发表于 2010-8-3 10:44:11 | 显示全部楼层

回复 9# 的帖子

哪种方法搞定的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则