Objective:
Import the data to navision table from Access table through ADO!
Variables :
varRecordset
@Automation 'Microsoft ActiveX Data Objects Recordset 2.8 Library'.Recordset
varFldCollection
@Automation 'Microsoft ActiveX Data Objects Recordset 2.8 Library'.Fields
RecordVar
@RecordRef
FieldVar
@FieldRefCode:
....
varRecordset.Open (strSql ,StrConnString); // Connection String
REPEAT
varFldCollection := varRecordset.Fields; // Extracting Fields Collection From Recordset and Storing in Fields Collection Object
RecordVar.OPEN(table_ID);
RecordVar.RESET;
FOR i :=1 TO RecordVar.FIELDCOUNT DO BEGIN
FieldVar :=RecordVar.FIELDINDEX (i);
FieldVar.VALIDATE(varFldCollection.Item(i-1).Value);
RecordVar.INSERT; //error occurs!
END;
varRecordset.MoveNext // moving to next record
UNTIL varRecordset.EOF=TRUE ;
Problem:
I can not insert the data which I retrieve from Access tabe into the RecordRef table. But when I use MESSAGE('Value of the field %1 is %2',FieldVar.CAPTION,FieldVar.VALUE); to show the value I can see they have been retrieved. What I want to do is insert the data into Navision table.
guys! any idear?
Answers
The Student is the table existing both in Access Database and Navision Native Database. And ID is the first primary key field of that table. '01' is the value I retrieve from access table for ID field and it's also the first retrieved value.
MCP - MBS Navision
jle@naviworld.com
MCP - MBS Navision
jle@naviworld.com
i tried using your code but its giving me an Error "the datatype is not supported by C/SIDE You can Access data From anyone of the following datatypes VT_VOID,VT_I2,VT_I4,.....VT_BOOL".
strSql=SQL SERVER
StrConnStringProvider=SQLOLEDB.1;
Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=GULAM
Why is this happening and how can i fix this problem?
thanks
GD
varFldCollection.Item(0).value is the timestamp.
Make sure you exclude timestamp from your select statement or start from
varFldCollection.Item(1).value
cheers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n