Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
ASP VBscript calling a function
Old 02-23-2006, 06:26 AM ASP VBscript calling a function
Skilled Talker

Posts: 95
Trades: 0
Ok i'm calling a function and passing it one variable this works fine and dandy. Pass it another it falls flat on its face why?

the code i'm using to send to the function is:

Code:
multiple(Miles,VehcileType)
i thought it might be a problem with my function so i made a very simple function. which is:

Code:
 
function multiple(one, two)
response.write one
response.write two
end function
Both Miles and VehicleType work when set as one argument but not when sent together?

can you help
higginbt is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-23-2006, 06:31 AM Re: ASP VBscript calling a function
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
knowing what the error is would be useful
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-23-2006, 06:35 AM Re: ASP VBscript calling a function
Skilled Talker

Posts: 95
Trades: 0
Do to they way the server is set up i dont get useful error message i just get page not found.

all i can tell you is if i pass either one through alone it works pass two together it doesnt

either with the page not found error or, the message the was an error at the the server.
higginbt is offline
Reply With Quote
View Public Profile
 
Old 02-23-2006, 11:38 AM Re: ASP VBscript calling a function
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
If you get Page Not Found then it's probably not likely to be the script causing the problem... it's more likely to be that the script isn't there or you're typing in the URL wrong.

If it's an Internal Server error however, have you tried going into the advanced options in IE and turning off 'Show friendly HTTP error messages'? It might be the browser that's set up to do that, not the server.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 02-23-2006, 11:59 AM Re: ASP VBscript calling a function
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
I notices you spelt "VehcileType" wrong, shouldn't it be "VehicleType"? If you have option explicit turned on, this would cause a problem.

Other then that, follow Minaki's adivce to get a better error message.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 03-02-2006, 09:42 AM Re: ASP VBscript calling a function
Skilled Talker

Posts: 95
Trades: 0
Ok thanks for all your help people but as i mentioned i found the trouble was that if was passing two or more objects to the function i had to use 'CALL'
higginbt is offline
Reply With Quote
View Public Profile
 
Old 03-02-2006, 02:54 PM Re: ASP VBscript calling a function
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
so the error was
"Microsoft VBScript compilation error '800a0414' Cannot use parentheses when calling a Sub"

with that error you can simply use

multiple Miles,VehicleType

or use a dummy variable

dummy = multiple(Miles,VehicleType)

or as you found use call sub/function
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-05-2006, 01:33 PM Re: ASP VBscript calling a function
Super Talker

Posts: 144
Trades: 0
and it's also good to note that a function in VB is required to RETURN A VALUE; your function does not...

function myFunc()
myFunc = "some value"
end function

dim myVar
myVar = myFunc() ' now contains "some value"

otherwise you want a sub routine

sub mySub
' do stuff
end sub

' to execute
mySub
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-05-2006, 02:22 PM Re: ASP VBscript calling a function
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
a function in asp vbscript is not required to return a value, a return value is optional
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-05-2006, 02:28 PM Re: ASP VBscript calling a function
Super Talker

Posts: 144
Trades: 0
Quote:
Originally Posted by chrishirst
a function in asp vbscript is not required to return a value, a return value is optional
hmm, u're right there. had to test it; I was certain I ran into that error before where it threw an error because I wasn't returning a value... I'll think about what it was. good stuff.
__________________
create.vibe

Please login or register to view this content. Registration is FREE
createvibe.com is offline
Reply With Quote
View Public Profile Visit createvibe.com's homepage!
 
Old 03-05-2006, 05:17 PM Re: ASP VBscript calling a function
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
the error is caused when you do not have an assignment for the returned value (if any) and use parantheses with more than one parameter.

using
retValue = Function(param1, param2)
would be ok

but Function(param1, param2) would not
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to ASP VBscript calling a function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31762 seconds with 12 queries