ADO Recordsets and SQLServer Type 'Decimal'

jsnayberk
Member Posts: 58
I have to access an external database (SQL-Server) from inside Navision (4.00). I use Microsoft ActiveX Data Objects 2.8 Library to do the job and everything works fine, exept one thing:
When I try to get a SQL-Decimal (9-bit float) into a Navision-Decimal (8-bit float) I run into an error telling me that these types are not compatible.
In a test database I changed the SQL data type to 'Money' and something like
Unfortunately I cannot change the data type in the customers database. So I have to find a way to access this SQL-Decimal field.
Any ideas?
When I try to get a SQL-Decimal (9-bit float) into a Navision-Decimal (8-bit float) I run into an error telling me that these types are not compatible.
In a test database I changed the SQL data type to 'Money' and something like
EVALUATE(navDecimal,FORMAT(adoRS.Fields.Item('Amount').Value));worked fine.
Unfortunately I cannot change the data type in the customers database. So I have to find a way to access this SQL-Decimal field.
Any ideas?
--
Josef Snayberk
Josef Snayberk
0
Comments
-
Hi
Try to use variant varialbes
and then, use evaluate to convert variant variable to decimalnavVariant:= adoRS.Fields.Item('Amount').Value; evaluate(navDecimal,NavVariant);
Bye0 -
Sorry, wan´t work.
Atevaluate(navDecimal,NavVariant);
following error message appears:
'You cannot enter '☺' in Decimal. The cursor is in front of the invalid character.'
But finally I found a (may be crippled) solution:
I use two recordsets. The first one with sql:
select DocNo, cast(Amount as Money) as Amount from MyTable
to assign the amount field to Navision Decimal variable;
and the second recordset with sql:
select * from MyTable where DocNo = 999
to update a certain record.
For the update of the amount field I can use a Navision Decimal variable without problems because no information will be lost in this direction.--
Josef Snayberk0 -
[Topic moved from Navision forum to SQL General forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions