|
 |
asp_web_howto thread: Functions And Data types
Message #1 by "Zaragoza, Enzo" <enzaux@g...> on Thu, 24 Jan 2002 01:37:37 +0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0227_01C1A477.B46FE4E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hello!!!
I have two things that is bothering me about data types and
functions in asp. Please help me clarify this things
1.) Is there a way in ASP to declare the data types of variables?
e.g.
In VB6
Dim Num1, Num2 as integer
Dim String1 as string
Why is it that I've noticed that variables in ASP are declared only
as Dim Num1? What is the explanation for these?
2.) I've made this function that will add two numbers
function add(no1,no2)
add =3D no1 + no2
end function
.
.
.
.
dim test
test =3D add(1,4)
Everything works fine IF the function is within the asp file BUT
when I try to put the function on another ASP and include it and error
occurs
"type mismatch test". Is there anything that I need to do inorder
for the function to work?
Please advise.
Thanks,
Enzo :)
Message #2 by "Debreceni, David" <Debreceni.David@h...> on Wed, 23 Jan 2002 12:30:02 -0500
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1A433.96B07A80
Content-Type: text/plain;
charset="iso-8859-1"
The reason for no type in asp as far as I know is because asp variables are
treated as variants.
As for your adding function try to change this line
add = no1 + no2
to this and see if it works
add = cint(no1) + cint(no2)
Hope that helps ya
David Debreceni
Developer
xxx-xxx-xxxx x 1086
Message #3 by jstmehr4u3@a... on Wed, 23 Jan 2002 17:52:15 +0000
|
|
First. ASP is relativly new as a Programming Technology.
All variables are Variants until you put something in
the variable. Once that is complete, the variable takes
on the datatype the data is.
Second. ASP does not understand Functions on other
pages. It sends, and compiles only the pages it asked to
send and compile. If your function is on page1.asp and
you are calling it on page2.asp, IIS will have no idea
where to find your function, unless you set a pointer to
page1.asp. The way to do that is with the INCLUDE
statement, much like C. <!-- Include
File="/include/page1.asp" --> add that line (Check for
syntax) at the top of your page, and your function will
work.
HTH,
Mike
Message #4 by "Zaragoza, Enzo" <enzaux@g...> on Thu, 24 Jan 2002 02:12:12 +0800
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_02AE_01C1A47C.88CB2840
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks Mike!!!!
Enzo :)
----- Original Message -----
From: jstmehr4u3@a...
To: ASP Web HowTo
Sent: Thursday, January 24, 2002 1:52 AM
Subject: [asp_web_howto] RE:Functions And Data types
First. ASP is relativly new as a Programming Technology.
All variables are Variants until you put something in
the variable. Once that is complete, the variable takes
on the datatype the data is.
Second. ASP does not understand Functions on other
pages. It sends, and compiles only the pages it asked to
send and compile. If your function is on page1.asp and
you are calling it on page2.asp, IIS will have no idea
where to find your function, unless you set a pointer to
page1.asp. The way to do that is with the INCLUDE
statement, much like C. <!-- Include
File=3D"/include/page1.asp" --> add that line (Check for
syntax) at the top of your page, and your function will
work.
HTH,
Mike
$subst('Email.Unsub').
|
|
 |