29 June 2014

VB6: Tipe Data dalam Visual Basic 6


Visual basic memiliki banyak tipe data. Tipe data digunakan untuk mendeklarasikan variable. Saat deklarasi memori digunakan untuk alokasi tipe data. Masing-masing tipe data digunakan untuk menyimpan tipe nilai yang berbeda.

Tabel penggunaan memori untuk setiap tipe data.

NoData TypeStorageNoData TypeStorage
1Byte1 byte8String (variable-length)Length + 10 bytes
2Boolean2 bytes9String (Fixed-Length)Length of string
3Integer2 bytes10Currency8 bytes
4Long4 bytes11Decimal12 bytes
5Single4 bytes12Object4 bytes
6Double8 bytes13Variant (numeric)16 bytes
7Date8 bytes14Variant (text)length +22 bytes

Tabel range nilai tipe data
Data TypeValue Range
Byte 0 to 255
BooleanTrue/False
Integer-32,768 to 32,767
Long-2,147,483,648 to 2,147,483,647
Single-3.402823*10^3 to -1.401298*10^45 for negative values
1.401298*10^-45 to 3.402823*10^38 for positive values
Double-1.79*10^308 to -4.94*10^-324 for negative values
4.94*10^-324 to 1.79*10^308 for positive values
DateJanuary 1, 100 to December 31, 9999
String (Variable length)0 to approximately 2 billion characters
String (Fixed length)1 to 65,400 characters
Currency-922,337,203,685,477.5808 to 922,337,203,685,477.5807
Decimal+,-79,228,162,514,264,337,593,543,950,335 if no decimal is used
+,-7.9228162514264337593543950335 (28 decimal places)
ObjectAny object
Variant (numeric)Any value as 16px as Double
Variant (text)Same as variable length string

Click here if you like this article.


2 comments:

Panji Abdi said...

mbak, mau nanya. bagaimana script untuk update atau insert ke sql server tetapi tipe datanya itu dalam bentuk byte? apa harus di serialize kan terlebih dahulu?

rani irsan said...

pake parameter