Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- ASP simple explanation anyone
March 10, 2005, 8:40 pm
rate this thread
I have been learning ASP from a book I bought a week ago and so far it
is very informative, but I seem to be confused on one simple term.
Variant. Now I learned how to declare a varible with the dim keyword,
and now I learned about subtypes and how to add values for my varible,
but everytime they show an example they go from varible to the word
variant. Now I know the definition of variant in the asp world, but I
am confused cause, are they refering to my varible as a variant? Are
they the same thing?
Can someone give me a yes or no answer.
Re: ASP simple explanation anyone
Gazing into my crystal ball I observed firstname.lastname@example.org writing in
> I have been learning ASP from a book I bought a week ago and so far it
> is very informative, but I seem to be confused on one simple term.
> Variant. Now I learned how to declare a varible with the dim keyword,
> and now I learned about subtypes and how to add values for my varible,
> but everytime they show an example they go from varible to the word
> variant. Now I know the definition of variant in the asp world, but I
> am confused cause, are they refering to my varible as a variant? Are
> they the same thing?
> Can someone give me a yes or no answer.
This is a client side group, and you need an ASP server side group.
Please respond to the group so others can share
Re: ASP simple explanation anyone
It was somewhere outside Barstow when email@example.com wrote:
>I have been learning ASP
> from a book I bought a week ago
I really quite like ASP. But I've yet to see any good reference or
tutorial for it. When I first learned it it took a _long_ time before
I realised just how much of it to throw away, and what little of the
core was worth keeping hold of. The trouble is (like nearly all
M$oft products) it's a good core product weighed down by baggage
that's loaded onto it because it fitted some M$oft corporate agenda.
One vital thing to remember is that there's no "ASP language". ASP is
just a container for languages - any language engine that can
co-operate with a pretty simple COM interface can be used from ASP.
JScript, a slight variation). Other useful ones to know of are
PerlScript, PythonScript and even COBOLScript (!)
As a general principle, throw VBScript away and just use JScript. It's
a much better language. There is _nothing_ you can do in VBScript that
you can't do (and better) in JScript. It's fundamental to ASP that
any of these languages can do everything external that the others can,
so you have a totally free choice depending on how good the language
M$oft usually have about half-a-dozen "VB" languages on the go at
once. There's VB (it makes Windows desktop apps), VBA (embedded into
Office) and the VBScript you're using with ASP. A few other dialects
too. When reading "VB books", make sure that they either apply to the
version you're using, or you understand the differences.
Of the three, VBScript is considerably cut down. One way it's cut
down is in variable typing. VB allows variable declaration with Dim
and also allows variables to be given types. VBScript doesn't - all
variables are of the "Variant" type (exactly the same as "Dim foo As
Variant" in VB). You can still declare them, or let them be
auto-declared when first used (you should _always_ use Option
Explicit and declare them yourself - it saves a lot of bugs).
>Now I learned how to declare a varible with the dim keyword,
>and now I learned about subtypes and how to add values for my varible,
>but everytime they show an example they go from varible to the word
So this description isn't an ASP thing, it's a VBScript thing. Be
wary of any book that doesn't realise there's an important difference
between these ! If you don't get their distinction quite clear in
your mind, you'll have a lot of trouble.
In VBScript, every variable is of Variant type. But it's still poorly
worded to mix these two words up in a textbook. A "variant" is not a
"variable" - they're different things; one's effectively an adjective
and the other is a noun. Just because every one of these nouns can be
described by that same adjective doesn't mean that they're "the same
>Now I know the definition of variant in the asp world,
One useful thing about VBScript and ASP is that ASP's only variable
types are the Object and the Variant, and these are also VBScript's
native types (they're actually native types of COM, which underlies
the whole lot). This makes some tasks very simple, because you don;t
have to do any conversion. OTOH, it also makes some VBScript code
inelegant and inefficient, because you can't type more appropriately
if you otherwise could do.