Hi QTPLearn,
thanks a lot, but what to do when:
in such cases this method doesn't work
I found a method which is good at the moment, but I am not sure if it will be good all the time(when the format of str_Value in the DB will be another and will be of a numbered format).
VarType Constants
These constants are only available when your project has an explicit reference to the appropriate type library containing these constant definitions. For VBScript, you must explicitly declare these constants in your code.
|Constant |Value| |Description|
vbEmpty |0 |Uninitialized (default)
vbNull |1 |Contains no valid data
vbInteger |2 |Integer subtype
vbLong |3 |Long subtype
vbSingle |4 |Single subtype
vbSingle |5 |Double subtype
vbCurrency |6 |Currency subtype
vbDate |7 |Date subtype
vbString |8 |String subtype
vbObject |9 |Object
vbError |10 |Error subtype
vbBoolean |11 |Boolean subtype
vbVariant |12 |Variant (used only for arrays of variants)
vbDataObject |13 |Data access object
vbDecimal |14 |Decimal subtype
vbByte |17 |Byte subtype
vbArray |8192 |Array
At the moment, my constants are of the vbDecimal type (nr. 14). But I am not sure that for all my tests/ queries this will be the only one type of constants.
thanks a lot, but what to do when:
Code:
str_Value = 123,231
in such cases this method doesn't work
I found a method which is good at the moment, but I am not sure if it will be good all the time(when the format of str_Value in the DB will be another and will be of a numbered format).
Code:
Dim MyCheck
MyCheck = varType(dBitem)
If MyCheck <> 8 Then
' formating the value of the string - max 2 nr.'s after the dot (e.g.: 123.09)
dBitem = FormatNumber(dBitem, 2)
Else
End If
VarType Constants
These constants are only available when your project has an explicit reference to the appropriate type library containing these constant definitions. For VBScript, you must explicitly declare these constants in your code.
|Constant |Value| |Description|
vbEmpty |0 |Uninitialized (default)
vbNull |1 |Contains no valid data
vbInteger |2 |Integer subtype
vbLong |3 |Long subtype
vbSingle |4 |Single subtype
vbSingle |5 |Double subtype
vbCurrency |6 |Currency subtype
vbDate |7 |Date subtype
vbString |8 |String subtype
vbObject |9 |Object
vbError |10 |Error subtype
vbBoolean |11 |Boolean subtype
vbVariant |12 |Variant (used only for arrays of variants)
vbDataObject |13 |Data access object
vbDecimal |14 |Decimal subtype
vbByte |17 |Byte subtype
vbArray |8192 |Array
At the moment, my constants are of the vbDecimal type (nr. 14). But I am not sure that for all my tests/ queries this will be the only one type of constants.