How to copy a NAV Record to an ADO Record

MatteoSpMatteoSp Member Posts: 4
In Navision 5, i need to copy all fields of a Navision record to a new ADO Record?
Is there a way to do this in a generic way?

thanks
m.

Comments

  • ara3nara3n Member Posts: 9,256
    you can create a sql query with a select statement.

    Select the Nav table you need to view.

    The return will be a record set.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • MatteoSpMatteoSp Member Posts: 4
    many thanks, but consider this:

    1) I need the generic way, so: is there a way to extract the table name from the NAV record?
    2) When the data does not yet exist (for example when I'm about to insert the record), I still need to copy values
    from the NAV record to the ADO record.

    thanks again
    m.
  • ara3nara3n Member Posts: 9,256
    you will need to loop through the NAV record and insert them one record a time.

    NAVRecord.findset;
    repeat

    ADOCommand.execute('
    Insert INTO SQL TABLE
    (FIELD1,FIELD2)
    VALUES
    ('+ NAVRecord.field1 + ','+ NAVRecord.Field2 + ')';

    until NAVRecord.next = 0;

    ADO is build around string and that is what you can pass back.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • MBergerMBerger Member Posts: 413
    Take a look into Recordrefs and Fieldrefs....they work a bit like ADO recordsets, making you able to loop through a NAV record.
  • MatteoSpMatteoSp Member Posts: 4
    do you now where I can find some (good) docs about Recordrefs and Fieldrefs?
Sign In or Register to comment.