ASP works on Personal Web Server, but not on remote server
Author |
Message |
John Meye #1 / 8
|
 ASP works on Personal Web Server, but not on remote server
On one of my ASP pages, I use Left() to extract the first paragraph off of a story. It works on my Personal Web Server at home, but not when I upload it to my remote site. Here is the error: Microsoft VBScript runtime error '800a0005' Invalid procedure call or argument: 'Left' /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 10:35:18 GMT |
|
 |
Bret Her #2 / 8
|
 ASP works on Personal Web Server, but not on remote server
John: it might be a bit more helpful to see the actual code you're trying to execute.
Quote: > On one of my ASP pages, I use Left() to extract the first paragraph off of a > story. It works on my Personal Web Server at home, but not when I upload it > to my remote site. Here is the error: > Microsoft VBScript runtime error '800a0005' > Invalid procedure call or argument: 'Left' > /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 11:25:34 GMT |
|
 |
John Meye #3 / 8
|
 ASP works on Personal Web Server, but not on remote server
<% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %>
Quote: > John: it might be a bit more helpful to see the actual code you're trying to > execute.
> > On one of my ASP pages, I use Left() to extract the first paragraph off of > a > > story. It works on my Personal Web Server at home, but not when I upload > it > > to my remote site. Here is the error: > > Microsoft VBScript runtime error '800a0005' > > Invalid procedure call or argument: 'Left' > > /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 13:01:13 GMT |
|
 |
Michael Harri #4 / 8
|
 ASP works on Personal Web Server, but not on remote server
Note that the error message includes "...or argument...". You need to check what the argument values actually are that are being passed to Left(). The only way I know of to deliberately get Left() to throw this error is to pass it a negative number as the 2nd argument. -- Michael Harris Microsoft.MVP.Scripting --
Please do not email questions - post them to the newsgroup instead. --
Quote: > On one of my ASP pages, I use Left() to extract the first paragraph off of a > story. It works on my Personal Web Server at home, but not when I upload it > to my remote site. Here is the error: > Microsoft VBScript runtime error '800a0005' > Invalid procedure call or argument: 'Left' > /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 13:42:27 GMT |
|
 |
Michael Harri #5 / 8
|
 ASP works on Personal Web Server, but not on remote server
<% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %> You have 2 instances of Left() here - which one fails??? (My bet is on the 2nd ;-)... if in the 1st one strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) the instr() doesn't find "</p>" (case sensitive) in CStr(RS(2)) then strTeaser winds up being assigned an empty string. The instr() resolves to 0 which is valid as the 2nd arg of Left() but causes it to return an empty string. But then in strTeaser = Left(strTeaser,(len(strTeaser) - 1)) (len(strTeaser) - 1)) will resolve to -1 if strTeaser is already empty. Passing a negative number to the 2nd arg of Left() will throw exactly the error you get... -- Michael Harris Microsoft.MVP.Scripting --
Please do not email questions - post them to the newsgroup instead. --
Quote: > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %>
> > John: it might be a bit more helpful to see the actual code you're trying > to > > execute.
> > > On one of my ASP pages, I use Left() to extract the first paragraph off > of > > a > > > story. It works on my Personal Web Server at home, but not when I > upload > > it > > > to my remote site. Here is the error: > > > Microsoft VBScript runtime error '800a0005' > > > Invalid procedure call or argument: 'Left' > > > /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 14:19:25 GMT |
|
 |
John Meye #6 / 8
|
 ASP works on Personal Web Server, but not on remote server
Okay, it's the second, yet it works on my data at home. My database at home isn't the same as the one on the site, but they're similar. So, what is the solution?
Quote: > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %> > You have 2 instances of Left() here - which one fails??? (My bet is on the > 2nd ;-)... > if in the 1st one > strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > the instr() doesn't find "</p>" (case sensitive) in CStr(RS(2)) then > strTeaser winds up being assigned an empty string. The instr() resolves to > 0 which is valid as the 2nd arg of Left() but causes it to return an empty > string. > But then in > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) > (len(strTeaser) - 1)) will resolve to -1 if strTeaser is already empty. > Passing a negative number to the 2nd arg of Left() will throw exactly the > error you get... > -- > Michael Harris > Microsoft.MVP.Scripting > --
> Please do not email questions - post them to the newsgroup instead. > --
> > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %>
> > > John: it might be a bit more helpful to see the actual code you're > trying > > to > > > execute.
> > > > On one of my ASP pages, I use Left() to extract the first paragraph > off > > of > > > a > > > > story. It works on my Personal Web Server at home, but not when I > > upload > > > it > > > > to my remote site. Here is the error: > > > > Microsoft VBScript runtime error '800a0005' > > > > Invalid procedure call or argument: 'Left' > > > > /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 14:32:58 GMT |
|
 |
Michael Harri #7 / 8
|
 ASP works on Personal Web Server, but not on remote server
??? Defensive programming ??? Have you looked at the actual values you're working with? Does RS(2) actually contain "</p>" in lower case? Is there anything anywhere in any of this that guarantees that the data used in the first instr() will always be successful (in this case non-zero)? -- Michael Harris Microsoft.MVP.Scripting --
Please do not email questions - post them to the newsgroup instead. --
Quote: > Okay, it's the second, yet it works on my data at home. My database at home > isn't the same as the one on the site, but they're similar. So, what is the > solution?
> > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %> > > You have 2 instances of Left() here - which one fails??? (My bet is on > the > > 2nd ;-)... > > if in the 1st one > > strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > the instr() doesn't find "</p>" (case sensitive) in CStr(RS(2)) then > > strTeaser winds up being assigned an empty string. The instr() resolves > to > > 0 which is valid as the 2nd arg of Left() but causes it to return an empty > > string. > > But then in > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) > > (len(strTeaser) - 1)) will resolve to -1 if strTeaser is already empty. > > Passing a negative number to the 2nd arg of Left() will throw exactly the > > error you get... > > -- > > Michael Harris > > Microsoft.MVP.Scripting > > --
> > Please do not email questions - post them to the newsgroup instead. > > --
> > > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %>
> > > > John: it might be a bit more helpful to see the actual code you're > > trying > > > to > > > > execute.
> > > > > On one of my ASP pages, I use Left() to extract the first paragraph > > off > > > of > > > > a > > > > > story. It works on my Personal Web Server at home, but not when I > > > upload > > > > it > > > > > to my remote site. Here is the error: > > > > > Microsoft VBScript runtime error '800a0005' > > > > > Invalid procedure call or argument: 'Left' > > > > > /usctoday/index.asp, line 85
|
Sun, 22 Jun 2003 14:51:47 GMT |
|
 |
Steve Mil #8 / 8
|
 ASP works on Personal Web Server, but not on remote server
Why don't you clean up the code a bit. Try something like: myStory = CStr(rs(2)) paraPos = InStr(1, LCase(myStory), "</p>") ' LCase handles any case sensitivity If paraPos <> 0 Then firstPara = Mid(myStory, 1, paraPos - 1) Else do something else here when </p> isn't found End If
Quote: > Okay, it's the second, yet it works on my data at home. My database at home > isn't the same as the one on the site, but they're similar. So, what is the > solution?
> > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %> > > You have 2 instances of Left() here - which one fails??? (My bet is on > the > > 2nd ;-)... > > if in the 1st one > > strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > the instr() doesn't find "</p>" (case sensitive) in CStr(RS(2)) then > > strTeaser winds up being assigned an empty string. The instr() resolves > to > > 0 which is valid as the 2nd arg of Left() but causes it to return an empty > > string. > > But then in > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) > > (len(strTeaser) - 1)) will resolve to -1 if strTeaser is already empty. > > Passing a negative number to the 2nd arg of Left() will throw exactly the > > error you get... > > -- > > Michael Harris > > Microsoft.MVP.Scripting > > --
> > Please do not email questions - post them to the newsgroup instead. > > --
> > > <% strTeaser = Left(Cstr(RS(2)),instr(1,Cstr(RS(2)),"</p>")) > > > strTeaser = Left(strTeaser,(len(strTeaser) - 1)) %>
> > > > John: it might be a bit more helpful to see the actual code you're > > trying > > > to > > > > execute.
> > > > > On one of my ASP pages, I use Left() to extract the first paragraph > > off > > > of > > > > a > > > > > story. It works on my Personal Web Server at home, but not when I > > > upload > > > > it > > > > > to my remote site. Here is the error: > > > > > Microsoft VBScript runtime error '800a0005' > > > > > Invalid procedure call or argument: 'Left' > > > > > /usctoday/index.asp, line 85
|
Mon, 23 Jun 2003 06:36:11 GMT |
|
|
|