ADO Connection not working!?

r44712
Member Posts: 40
Hi
I've a system that connects Navision with a program that we've written internally, both using SQL databases.
I've implimented some code:
Which is called from codeunit 22 (Item Jnl.-Post Line) as when an item has been purchased, +ve increased, or transferred into a location that we sell goods from:
This code has been tested as working previously (on occasion) producing the required outcome on the external system.
However, every now an again it seems to cause Navision to hang for a long while and we either get the error that the connection has timed-out of there is an error near the syntax '123456' (where 123456 is the item no.).
Which is all very confusing, becuase if I add a line to a codeunit (with no other lines in it) it calls the stored procedure without any problem and updates the external system everytime. ](*,)
Its all very odd!!! Has anyone experienced this problem themselves, or know of any way to resolve it, thanks?
I've a system that connects Navision with a program that we've written internally, both using SQL databases.
I've implimented some code:
IF ISCLEAR(ADOConnection) THEN BEGIN IF NOT CREATE(ADOConnection) THEN ERROR('Cannot create ADO Connection automation variable.'); END; IF ISCLEAR(ADORecSet) THEN BEGIN IF NOT CREATE(ADORecSet) THEN ERROR('Cannot create ADO Recordset automation variable.'); END; IF ISCLEAR(ADOCommand) THEN BEGIN IF NOT CREATE(ADOCommand) THEN ERROR('Cannot create ADO Command automation variable.'); END; IF ISCLEAR(ADOStream) THEN BEGIN IF NOT CREATE(ADOStream) THEN ERROR('Cannot create ADO Stream automation variable.'); END; ConnString := 'Provider=SQLOLEDB;Data Source=' + DbServer + ';' + 'Initial Catalog=' + DbName + ';User ID=' + DbUsername + ';Password=' + DbPassword + ';'; ADOConnection.ConnectionString(ConnString); ADOConnection.Open; ADOCommand.ActiveConnection := ConnString; ADOCommand.CommandText := STRSUBSTNO('UpdateAuctionStatusWithStock ''%1''',ItemNo); ADOCommand.Execute(); CloseConnection;
Which is called from codeunit 22 (Item Jnl.-Post Line) as when an item has been purchased, +ve increased, or transferred into a location that we sell goods from:
ADOMgmt.InsertItemNo(ItemLedgEntry."Item No.");
This code has been tested as working previously (on occasion) producing the required outcome on the external system.
However, every now an again it seems to cause Navision to hang for a long while and we either get the error that the connection has timed-out of there is an error near the syntax '123456' (where 123456 is the item no.).
Which is all very confusing, becuase if I add a line to a codeunit (with no other lines in it) it calls the stored procedure without any problem and updates the external system everytime. ](*,)
Its all very odd!!! Has anyone experienced this problem themselves, or know of any way to resolve it, thanks?
0
Comments
-
This is such a confusing problem and seemingly imposible to debug as making a change works for a bit and then stops working. Try it again the following day and all is fine for a short while??? :-k0
-
I think that problem can be in UpdateAuctionStatusWithStock. Is it stored procedure?0
-
lubost wrote:I think that problem can be in UpdateAuctionStatusWithStock. Is it stored procedure?
It is yeah. With much headscratching, it turns out that it was trying to access a table that was locked by navision as part of the posting process...
Thanks for the input, anyhow!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