When I use the code below, everything is fine unless a decimal value is used. It always fails on the first record, regaurdless if it is a 0 value or a positive number. When I pass the value into a variant variable and step through the debugger it says the value of the Variant is "Value". The error message is:
This message is for C/AL programmers:
This data type is not supported by C/SIDE. You can access data of any of the following data types: VT_VOID, VT_I2, VT_I4, VT_R4, VT_R8, VT_CY, VT_DATE, VT_BSTR and VT_BOOL"
I searched the forum and found a few threads about this but none of the solutions worked for this issue. ](*,)
FOR i := 1 TO adoRS.Fields.Count DO BEGIN
IF NOT IsNull(adoRS.Fields.Item(i-1)) THEN BEGIN
SQLFieldName := adoRS.Fields.Item(i-1).Name;
vFieldVal := adoRS.Fields.Item(i-1).Value;
ValueString := FORMAT(adoRS.Fields.Item(i-1).Value); //Error occures here
END;
END;
Where IsNull is a function to check for Null Values
Where vFieldVal is a Varient
Answers
How looks you sql query (select * or select "No_", Description, etc.) :?:
Regards
mhm, I think you have it, so ive no problems with using decimals
do you will connect to an access "database" :?:
if yes is the field datatype long integer or double?
I have tried both the evaluate and format commands and neither seem to work. Can you give me an example of code where you are taking a decimal value from a ADO Recordset Field and converting it to decimal?
This works for me
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
- my blog
- mibuso
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Its a little strange, but you first have to write the variant out to an outstreem, and then read the data back in as text via an instream.
Once you do that, you can evaluate it to a decimal.
I'll look around for some code samples, but you can definitely find detailed posts about this on mibuso and on dynamics users group (I think I posted about it a year or so ago)
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Please ignore any of my custom functions...
[/code]