Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

VarType

The VarType function returns the subtype of an ASP variable. We say subtype because all variables in ASP have the type of Variant. The subtype determines what type of value is stored in the variant. The chart below shows you all of the possible types that a variable may hold:

Type Value Comments
vbEmpty 0 Uninitialized variable
vbNull 1 No meaningfull data
vbInteger 2 Whole number
vbLong 3 Long integer
vbSingle 4 Single-precision floating point number
vbDouble 5 Double-precision floating point number
vbCurrency 6 Decimal number to hold money values
vbDate 7 Date value only (no time)
vbString 8 Text string
vbObject 9 Object refernences (use TypeName to determine object type)
vbError 10 Holds an error object
vbBoolean 11 Holds either True or False
vbVariant 12 Only returned for array of variants
vbDataObject 13 Data access component
vbDecimal 14 Decimal number
vbByte 15 Byte value (0 - 255)
vbArray 16 Variable array


If you call the VarType function and it returns the value vbObject, you may use a subsequent call to TypeName to determine which type of object the variable references. An example of this is shown below:

Dim sEmpty
Dim dDate
Dim oHash
dDate = Now()
Set oHash = Server.CreateObject("Scripting.Dictionary")

Response.Write "VarType(sEmpty) = " & VarType(sEmpty) & "<BR>"
Response.Write "VarType(dDate) = " & VarType(dDate) & "<BR>"
Response.Write "VarType(oHash) = " & VarType(oHash) & "<BR>"
Response.Write "TypeName(oHash) = " & TypeName(oHash) & "<BR>"

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"Democracy consists of choosing your dictators, after they've told you what it is you want to hear." - Alan Coren

©2007 Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.