Working with ADO i am trying to understand field definitions as :
CREATE TABLE TestTable ( ID COUNTER PRIMARY KEY ,
[FIELD2] CHAR(20) NOT NULL DEFAULT 'Fivewin power' ,
[FIELD3] NUMERIC(10,0) DEFAULT 0 )
- Code: Select all Expand view
oRS:AddNew()
a := {1,nil,0}
FOR i := 1 TO oRs:Fields:count
WITH OBJECT oRs:Fields(i-1)
? :Value == nil // Give 3 times .T. , value from each field seems to be nil
try
:Value = a[ i ]
catch
? " Error on field " + :Name , a[i]
end
END
NEXT
oRs:Update()
FOR i := 1 TO oRs:Fields:count
WITH OBJECT oRs:Fields(i-1)
? :Value , :Value == nil , VALTYPE(:Value)
END
NEXT
1) Default value has no effect. I expected the value from the second field to be 'fivewin power'
2) Second field has clause NOT NULL , but value nil is accepted.
The field has now a value SPACE(20) , same result with Clause NULL
3) Third field ? :Value --> 0.00 , expected 0 , maybe configuration from the aplication (SET DECIMALS)
Exact value can be retrieved using oField:Precision
It seems that on this way the clauses (NOT) NULL and DEFAULT have no effect.
Can this clauses be retrieved from ADO ? If not they are useless in the fivewin aplication.
Frank