Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 17th, 2003, 04:28 PM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default sub do not work with 2 variables

Hi!

Have a include file:
Function Uppdatera(s,j)
Uppdatera = s
End Function

Sub sUppdatera(s,j)

End Sub

Run it from another asp file. The funktion works but not the sub. If I change the sub to take only 1 variable it works:
Sub sUppdatera(s)

End Sub

Have first tried with things happening in the sub but have taken away more anf more. Whatever I do, when I take 2 or more variables in my sud I get server error :-( I have seen examples with 2 variables.

 
Old November 17th, 2003, 04:42 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What's the error you get?

You should not have a problem creating a sub with more than 1 argument. How many times are you defining this sub.. I see the sub and function are different by one char so they won't interfere.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old November 17th, 2003, 04:55 PM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

File sida1.asp:

<%
dim test
test = Uppdatera("w", "d")
sUppdatera(1)
%>

File adodb_databaskoppling.inc:
<%
Function Uppdatera(s,j)
    Uppdatera = s
End Function

Sub sUppdatera(s)

End Sub
%>

Works fine! Then I change to:

File sida1.asp:

<%
dim test
test = Uppdatera("w", "d")
sUppdatera(1, 5)
%>

File adodb_databaskoppling.inc:
<%
Function Uppdatera(s,j)
    Uppdatera = s
End Function

Sub sUppdatera(p,k)

End Sub
%>

I get "HTTP 500 Internal server error - Microsoft Internet Explorer" in the title bar. And on the page it says "The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed. " and so on.


 
Old November 17th, 2003, 05:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

you shouldn't use parenthesis when calling a sub - try:

Code:
<%
dim test
test = Uppdatera("w", "d")
sUppdatera 1, 5
%>
Håber det hjælper...



 
Old November 17th, 2003, 05:08 PM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I LOVE YOU!!! :-)

It works now!!!!!

 
Old November 17th, 2003, 05:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

By the way - you should have a look at this:
http://www.4guysfromrolla.com/webtech/020400-2.shtml

 
Old November 17th, 2003, 05:41 PM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again, you are really nice to a beginner!... And I really need help ;) It's adodb_databaskoppling.asp from now on...

 
Old November 17th, 2003, 06:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

Glad to help :)

 
Old November 17th, 2003, 06:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

Btw: Your initial problem with the sub would have been easily solved if you had gotten a proper error message...
Go to 'Internet Options'
Go to the advanced tab
Scroll down to 'Show friendly error messages' or something like that
(In danish it's called 'Vis meddelelser om uskadelige HTTP-fejl')
Uncheck it

This should give you more verbose error messages...






Similar Threads
Thread Thread Starter Forum Replies Last Post
variables daniel.mihalcea Javascript 1 September 9th, 2008 07:06 PM
Chapter 1 Ctrl+F5 don't work, F5 does work? jimboak BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 June 29th, 2008 03:46 AM
using variables webgrphx Classic ASP Basics 3 April 11th, 2007 06:46 PM
should this work? crmpicco Javascript How-To 1 January 18th, 2005 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.