Design  | SFC  |  NOS  |  Code |  Diary  | WWW |  Essay |  Cisco | [Home]
 

[Bill's Home]
[Old Page]

Quick links

WinSock in Visual Basic
WinSock multiserver
DHTML
CSS
Flash/XML
ASP
PHP
JavaScript
Java
Delphi
RSA
WAP
Java Socket Programming
Subnetting
RS-232
Subnetting
Word
Design Tips

Source Code

Pascal
Java
C Programming
Applied PC Interfacing
WinSock client
WinSock server
FTP client
HTTP client
Java client/server
HTTP client
Subnetting in VB
RS-232 in VB
WinSock Multiserver

 

ASP - Data Types

VBScript supports many standard functions, these include:

[Functions]

In VBScript there is only one data type: Variant. This type can contain several different types of information, such as strings, or numeric values. It is this type that is returned by all the functions using in VBScript. As much as possible VBScript assumes the data type that is be-ing used. For example if it is a numeric operation it will assume that the values are numeric, whereas a string search function would assume the values were strings. Strings, though, can always be defined within quotation marks.

In addition to variant, there are several subtypes, which can be used to convert from one representation to another, these are:

Empty.
This is were the variant is uninitialized. In a numeric value it will be set to zero, in a string format it will be a Null string.
Null.
No valid data.
Boolean.
This contains a True or False.
Byte.
This contains an integer in the range 0 to 255.
Integer.
This contains an integer in the range -32,768 to 32,767.
Currency.
This contains a range from-922,337,203,685,477.5808 to 922,337,203,685,477. 5807.
Long.
This contains an integer in the range -2,147,483,648 to 2,147,483,647.
Single.
This contains a single-precision, floating-point number in the range -3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values.
Double.
This contains a double-precision, floating-point number in the range -1.79769313486232E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values.
Date.
This contains a number that represents a date between January 1, 100 to Decem-ber 31, 9999.
String.
This contains a variable-length string that can be up to approximately 2 billion characters in length.
Error.
This contains an error number.

There are several functions which can be used to convert from one format to another. These include:

CBool Convert expression to a Variant of subtype Boolean.
CByte Convert expression to a Variant of subtype Byte.
CCur Convert expression to a Variant of subtype Currency.
CDate Convert expression to a Variant of subtype Date.
CDbl Convert expression to a Variant of subtype Double.
CInt Convert expression to a Variant of subtype Integer.
CLng Convert expression to a Variant of subtype Long.
CSng Convert expression to a Variant of subtype Single.
CStr Convert expression to a Variant of subtype String.

ASP example

<%
val1 = 10
val2 = 20
result = Cstr(val1) + Cstr(val2)
response.write "<BR>Value is " & result
result = val1 + val2
response.write "<BR>Value is " & result
%>

Executed code

Value is 1020
Value is 30

where it can be seen that the first operation has converted the values into strings and then implemented a string concatenate function, while the second version has implemented an arithmetic addition.