Options

Query Timeout Expired

vantonenasvantonenas Member Posts: 10
Hi all. i am executing in a Dynamics NAV 2015 a store procedure. The following message appears after 30 secs. have parameterized the connection string


txtConnectionString := '';
txtConnectionString += 'Provider=SQLOLEDB.1';
txtConnectionString += ';Persist Security Info=TRUE';
txtConnectionString += ';Data Source=Servername;
txtConnectionString += ';Initial Catalog=DatabaseName;

//txtConnectionString += ';CONNECT TIMEOUT=0';
//txtConnectionString += ';COMMAND TIMEOUT=0';

txtConnectionString += ';User ID=' + 'User ID';
txtConnectionString += ';Password=' + 'User ID';

txtConnectionString += ';Trusted Connection=TRUE';
txtConnectionString += ';Encrypt=FALSE';

Also parameterized the service but nothing. In SQL Server the procedure runs without issue.

Any help please???

Answers

  • Options
    vaprogvaprog Member Posts: 1,128
    Please go to the configuration of the service and check ‘SQLCommandTimeout’.
    Also check your remote query timeout settings on your SQL Server.
  • Options
    vantonenasvantonenas Member Posts: 10
    I had done this before. No results unfortunately.

    The procedure runs in SQL Server, however i turned to 0.

    Any other idea?
  • Options
    vremeni4vremeni4 Member Posts: 323
    hi

    I looks like you use ADO in NAV to connect to SQL and to execute Select or update statement.
    I would suggest you write a stored procedure in SQL that contains your T-SQL select or update statement and then you call the stored procedure from NAV.
    usually this runs much faster and you do not have to wait.

    Also if I look at you script above the line that sets time out is commented out
    //txtConnectionString += ';COMMAND TIMEOUT=0';

    Try to follow this blog how to connect and use ADO in ANV
    https://dynamicsuser.net/nav/b/waldo/posts/using-stored-procedures-in-c-side

    I hope this helps
Sign In or Register to comment.