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 添加到现有内容。
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
但是我得到一个错误:
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
怎么了?
尝试在您设置此文件路径的地方声明Private strAbsFile
我想如果 text = ""
创建内容为 userval 的新文件,但是如果 Len(text) > 0
那么我想找到现有文件并在其中更改此文本,所以如果不存在,请将文本和 userval 添加到现有内容。
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
但是我得到一个错误:
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
怎么了?
尝试在您设置此文件路径的地方声明Private strAbsFile