[Info]Data Types | Database Pt 2

Posts 1–6 of 6 · Page 1 of 1
[Info]Data Types | Database Pt 2
Data Types
Every day, people receive a large volume of data and process it. Humans can differentiate between various types of data without confusing them. For instance, humans can look at a series of data and categorize dates, numbers, payments and so on with minimal effort. However, computers need specific instructions to be able to process data. For example, if you just type 123, you cannot assume that the computer knows you entered numbers. You have to tell the computer about the type of data that is entered. Understanding data type can be a little confusing and requires some more explanation.

To illustrate data type, consider the following scenario: You have invited some of your friends over for a chess game, so you get the chessboard and all the pieces prepared. The board has 64 black and white squares and you need to place each piece on a specific square. Each piece has its own movement rules and authorities. You cannot place the king piece in the queen's square or use white pieces in place of black ones. You need to place each piece in its own square. Data type is very similar to this. Each piece of data will be stored in a different storage area and will be processed differently. Identifying data type is very important to computers. The computer reserves special storage for each data type and keeps track of them internally.
You may enter an address that includes numbers as well as alphabet characters. Although the address has numbers in it, by setting the data type as string you can treat it as alphabetical data.

I WILL NOW AGAIN draw up a table 4 u guys in Paint.NET



The most common datatypes we use are integer, string and decimal. The following sections give descriptions and examples of some of the data types in VB
Boolean
The values that can be stored in boolean data can onnly be true or false. We use this data type if we expect two possible states: yes/no or true/false. The default value of boolean data is False.

Integer
Integer data can contain signed whole numbers ranging from -2,147,483,648 through 2,147,483,547. The default value for integer type data is 0. If you assign a value that is outside of this range, you will get an error message. If you would like to store the result of the calculation, then do not use integer. Integer will not show the fractions. Here are some examples of Integer data
  • 21
  • 3
  • 25000
  • -11
  • 65432181


Long
Long is another integer data type that shold be used for signed whole numbers that are larger than the integer range. The range for long data is -9,224,372,036,854,775,808 through to 9,223,372,036,854,775,807 (9.2...E+18). The default value for long data is 0. Here are some examples of long integer data.

  • 1234567890998
  • -123456789099
  • -77898588098L


Short
The short data type is used to hold signed integer values ranging from -32,768 through to 32,767. We use this for values that do not require the whole range of the integer type. The default value for short data is 0. Here are some examples:

  • -32764
  • 22769
  • 32764S


Decimal
The decimal type of data can hold numbers in a fixed-point format and allows fractions and decimal points. Here are some examples

  • 6.05
  • 550.500
  • -300
  • 200D


Byte
This data type can contain integers ranging in value from 0 through 255. We use this data type to store binary data. Remember that the byte data type cannot contain the negative sign for the values, so if the negative sign plays a significant role in your data, other data types should be considered. The default value for byte data is 0

Double
Double data can store double-precision floating-point numbers ranging in value from -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values and from 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values. The default value for double data is 0. Here are some examples.

  • 6575.3
  • 5189.2R
  • -5467.3


Object
Object data is used to hold any type of data and was introduced in the VB.NET version. The default value for object data is nothing.

String
String data may contain letters such as A-Z or a-z, numbers 0-9 and all special characters such as %,$ and #. The numbers you use as string type cannot be used in calculations unless they are converted. The default value for string is Nothing. Here are some examples for string data type

  • "Mike"
  • "2005"
  • "$100.00"
  • "Visual Basic 2008"


Char
The Char data type should be used when you plan to store one unsigned character . If only one character should be stored, using the char type instead of the string type will prevent unneeded overhead. Unicode characters refer to the 128 characters(0-127) that are found on standard U.S. keyboards. It can hold values from 0 through 65535
thanks for sharing, it is very handy when it comes to declaring.
Indeed it is, thought it'd be handy as a first-on reference!
Thanks for sharing
Always a pleasure for MPGH :P
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us