NAVISION 2013 EXECUTE SQL QUERY

ALFEGO79ALFEGO79 Member Posts: 10
edited 2013-10-01 in NAV Three Tier
Hi everybody

We are trying to exectue a query in Navision 20013, this database is SQL server but it isnt a Navision 20013, in fact its a integration.

Before, Navision 2009 we usually execute this code and it works:



Now, in Navision 2013 we dont have Microsoft Active X, so when we have tried to execute this query,we have this error, any suggest?



Thank very much.

Answers

  • yukonyukon Member Posts: 361
    ALFEGO79,

    You should be use ADO.NET if you are using ActiveX Data Objects (ADO).

    http://msdn.microsoft.com/en-us/library/ms254937.aspx.
    http://msdn.microsoft.com/en-us/library/vstudio/h43ks021%28v=vs.100%29.aspx
    And you can refer sample code in CU104049 (Upgrade Upgrade601700.1 fob -- Version can be different).


    Best Regards,
    Yukon
    Make Simple & Easy
  • ALFEGO79ALFEGO79 Member Posts: 10
    thank you

    I ve got it a really easy way:


    lrsRecordset := adoConn.Execute(ptxtSQL, lnRecCount, 0);
    fFields := lrsRecordset.Fields;
    lrsRecordset.MoveFirst;

    REPEAT
    prrRecRef.INIT;

    //Arcaft

    lfrField := prrRecRef.FIELDINDEX(1);
    fFieldArcaft := fFields.Item(1);
    ltArcaft := FORMAT(fFieldArcaft.Value);
    lfrField.VALUE(ltArcaft);
    //quantity

    lfrquantity := prrRecRef.FIELDINDEX(2);
    fFieldquantity := fFields.Item(0);
    ltquantity := FORMAT(fFieldquantity.Value);
    lfrquantity.VALUE(ltquantity);

    prrRecRef.INSERT;
    lrsRecordset.MoveNext;
    UNTIL lrsRecordset.EOF;

    lrsRecordset.Close;
    adoConn.Close;
  • Maria-SMaria-S Member Posts: 90
    Hello!

    Does anybody faced the same issue as me?

    I am running the SQL stored procedure from NAV, using ADO, it executes well. I have the Execute button on one of my pages.

    My stored procedure is based on tables from NAV.

    Then, I change something is the database, execute the same SP one more time, and get the result which not reflect the latest changes. For example, if I change customer Name, the SP returns me the old customer name.

    Then I run the same SP in SQL Management Studio, it returns new customer Name. Moreover, when I click my Execute button on the RTC page after that, it also gives me the updated result.

    Does anybody know where can be a problem?

    Thanks in advance,
    Maria
Sign In or Register to comment.