How to get sql Table data in to navision table.

te6
Member Posts: 89
Hi all,
I Want to insert table data in to my navision database from another SQL 2005 Database . using ADOConnection, i written some code shown below
IF ISCLEAR(ADOConnection) THEN CREATE(ADOConnection);
ADOConnection.ConnectionString := ('Driver={SQL Server}; Server=servername; Database=dbname; Uid=userid; Pwd=password');
ADOConnection.Open;
SQLString := 'SELECT * FROM [DBNAME].[dbo].[TABLENAME]';
RecordSet1 := ADOConnection.Execute(SQLString);
RecordSet1.MoveFirst;
WHILE Cnt <=5 DO BEGIN
WeighBridge.ID:= RecordSet1.Fields.Item('ID').Value;
WeighBridge."FIELDNAME1" := RecordSet1.Fields.Item('FIELDNAME1').Value;
WeighBridge."FIELDNAME2" := RecordSet1.Fields.Item('FIELDNAME2').Value;
WeighBridge."FIELDNAME3" := RecordSet1.Fields.Item('FIELDNAME3').Value;
WeighBridge.INSERT;
RecordSet1.MoveNext;
Cnt+=1;
END;
ADOConnection.Close
it throws an error like
This message is for C/AL programmers:
This data type is not supported by C/SIDE. You can access data from
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 am not able to assign the fields which the data types are bigint ,decimal,int in SQL2005 in to the navision table Fields.
please suggest me.
Regards
AKHIL.
I Want to insert table data in to my navision database from another SQL 2005 Database . using ADOConnection, i written some code shown below
IF ISCLEAR(ADOConnection) THEN CREATE(ADOConnection);
ADOConnection.ConnectionString := ('Driver={SQL Server}; Server=servername; Database=dbname; Uid=userid; Pwd=password');
ADOConnection.Open;
SQLString := 'SELECT * FROM [DBNAME].[dbo].[TABLENAME]';
RecordSet1 := ADOConnection.Execute(SQLString);
RecordSet1.MoveFirst;
WHILE Cnt <=5 DO BEGIN
WeighBridge.ID:= RecordSet1.Fields.Item('ID').Value;
WeighBridge."FIELDNAME1" := RecordSet1.Fields.Item('FIELDNAME1').Value;
WeighBridge."FIELDNAME2" := RecordSet1.Fields.Item('FIELDNAME2').Value;
WeighBridge."FIELDNAME3" := RecordSet1.Fields.Item('FIELDNAME3').Value;
WeighBridge.INSERT;
RecordSet1.MoveNext;
Cnt+=1;
END;
ADOConnection.Close
it throws an error like
This message is for C/AL programmers:
This data type is not supported by C/SIDE. You can access data from
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 am not able to assign the fields which the data types are bigint ,decimal,int in SQL2005 in to the navision table Fields.
please suggest me.
Regards
AKHIL.
0
Comments
-
If your NAV database is also SQL, why not use a linked table instead of ADO?There are no bugs - only undocumented features.0
-
You can use this trick ;-)
On SQL do
CREATE VIEW TableTXT AS
SELECT CONVERT(varchar(40), BigIntNumber) AS BigIntNumberTXT
FROM YourTable
And after you can use this VIEW and work with any type of field. Almost any type \:D/Tomas Zadrapa0 -
And it works brilliantly.
But, in Nav 2013 you need to remember to use NVARCHAR for text and code fields instead of VARCHAR.
I just spent an hour working out why some of our code failed in 2013 when it worked fine in 2009 !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