ADODB.Stream参数的类型错误,超出可接受范围或彼此冲突 [英] ADODB.Stream Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another
问题描述
我想如果 text =
创建内容= userval的新文件,但是如果 Len(text)> 0
,然后我想找到现有文件并在其中更改此文本,因此如果不存在,请在现有内容中添加文本和userval。
I want if text = ""
create new file with contents = userval, but if Len(text) > 0
then I want find existing file and change in them this text so if not exist so add text and userval to existing content.
Public Property Let val(text,userval)
'on error resume next
Dim strText, strResult, strChange
If Len(text) >0 then
strChange = False
stream.open
stream.loadfromfile strAbsFile
strT = stream.readtext
splArr = split(strText,"^")
on error resume next
For i = 0 to Ubound(splArr)
splArrFields = split(splArr(i),"|")
If splArrFields(0) = text Then strChange = Replace(strText,splArrFields(0) & "^" & splArrFields(1),splArrFields(0) & "^" & userval) 'change value if exists
Next
If strChange Then strResult = strChange Else strResult = strT & "|" text & "^" & userval ' add text and value
stream.close
Else
strResult = userval
End If
response.write "text" & VarType(text) & " userval" & VarType(userval) & " strResult" & VarType(strResult) ' text8 userval8 strResult8
stream.open
stream.writetext mycstr(strResult)
for err11 = 0 to 50
stream.savetofile strAbsFile, 2
if Err.Number = 0 then exit for
Err.Clear
next
stream.close
End Property
但是出现错误:
错误:3001
错误(十六进制):BB9
来源:ADODB.Stream
说明:参数类型错误,超出可接受范围或与参数冲突另一个。
Error: 3001
Error (Hex): BB9
Source: ADODB.Stream
Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
我认为问题行是 stream.savetofile strAbsFile,2
出什么问题了?
推荐答案
尝试声明私有strAbsFile
设置此文件路径
Try to declare Private strAbsFile
in place there you set this file path
这篇关于ADODB.Stream参数的类型错误,超出可接受范围或彼此冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!