Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building a string error!!!!

Status
Not open for further replies.

Albuckj2

Programmer
Jan 7, 2003
68
GB
I can't understand an error I am getting while I am building a URL string. The full string code is at the bottom, but the following error occurs:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "&display"]'
/stocks/results2.asp, line 341

Line 341 is the following:
newURL = newURL & "&display" + cnt + "=" + sells(cnt)

Anyone know what this means?????


dim newURL, upper

newURL = "results_main.asp?"
upper = UBound(names1)
for g=0 to upper
newURL = newURL & "" + names1(g) + "=" + namesx(g) + "&" + mins(g) + "=" + minsx(g) + "&" + maxs(g) + "=" + maxsx(g)
next
newURL = newURL & "&sortby=" + Server.URLEncode(order) + "&upordown=" + Server.URLEncode(dir)
newURL = newURL & "&screenName=" + Server.URLEncode(screenName) + "&display_var=" + Server.URLEncode(display)
newURL = newURL & "&display_varcount=" + Server.URLEncode(displaycount)
for cnt=1 to displaycount
newURL = newURL & "&display" + cnt + "=" + sells(cnt)
next
newURL = newURL & "&pages=" + Server.URLEncode(Recordset1.PageSize)
newURL = newURL & "&marker=" + Server.URLEncode(marker) + "&page=" + iPageCurrent
 
Try converting the cnt variable to string:

Code:
newURL = newURL & "&display" + CStr(cnt) + "=" + sells(cnt)
--James
 
I am totaly going to take a stab in the dark at this one. I have seen that asp sometimes get confused as to whatit has to do, so maybe it is trying to add values mathematically
(asp's errormessages are not always that accurate)

try replacing the + with &

Before:
newURL = newURL & "&display" + cnt + "=" + sells(cnt)


After:
newURL = newURL & "&display" & cnt & "=" & sells(cnt)

Let me know if this works
Office notice: The beatings won't stop until morale improves
 
Doh, I really haven't woken up yet this morning...

tschonken is quite right - use the ampersand to concatenate strings. --James
 
Hi Guys,
Replacing the '+'s with '&'s did not work, but what JamesLean suggested did.
Cheers, Alex.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top