问题
Hi Below is my code of ASPClassic, in which csvData is a very large string containing variable.Now in this At line where Mid function is call error 'Invalid Procedure Call or argument : Mid' occur why this happens...
Dim dataLen
Dim fromLen
Dim toLen
Dim slab
Dim totalPass
dataLen =len(csvData)
fromLen =0
toLen =100000
slab =100000
totalPass =(dataLen/slab)
if (dataLen Mod slab)>0 then
totalPass=totalPass+1
end if
Dim i
For i = 0 To dataLen
i=toLen
if toLen > dataLen then
toLen=dataLen
end if
Response.Write Mid(csvData,fromLen,toLen)
fromLen=toLen
toLen=toLen+slab
Next
回答1:
I think that your fromLen is 0, when you call Mid() for the first time:
>> m = Mid("x", 0, 1)
>>
Error Number: 5
Error Description: Invalid procedure call or argument
Try to initialize with:
fromLen = 1
回答2:
mid start position can not be 0 it should always be from 1
来源:https://stackoverflow.com/questions/13970723/why-vbscript-mid-function-shows-error-invalid-procedure-call-or-argument-mid