Friday, August 27, 2010

Variable

As there are different types of values used in an application, there are also different requirements to store those values. to prepare a storage area, we type the Dim keyword followed by a name.

The Name of a Variable

To specify the name of a variable, there are rules we must follow:

  • The name of a variable must start with either a letter or an underscore. A name can have only one letter but if we start it with an underscore, then the underscore must be followed by a letter
  • After the first character as an underscore or a letter, the name can contain letters, digits, or underscores in any combination
  • The name must not contain space but it can be made of various words as long as these words are concatenated (added together to produce one word)
  • The name must not contain any symbol other than letters, digits, or underscores
  • After respecting these rules, we can adopt a naming convention that suits us.
Data Types

Unlike some other languages, VBScript recognizes only a data type called Variant when declaring a variable using the following formula:

Dim VariableName

The Variant data type can be used in place of any type. After declaring the variable, its type is still not know. If we had requested a value from the user, before involving it in a calculation, we should first convert it to the appropriate type. Fortunately, VBScript provides the necessary means (functions) to perform this conversion.

1 comment:

  1. Hello Binay,
    i have seen your Content,it is very useful for us, i request to u, plz u write for sql object.

    Thanks

    ReplyDelete