ADO Sql Timeout
gfarrell
Member Posts: 8
I created a codeunit to execute a stored procedure via ado as illustrated by several threads here and it works great. Thanks to all those who contributed.
I want to call the code from a processing only report, but I keep getting sql timeouts after several minutes. When the codeunit is run directly it runs in about one second.
I have also tried to copy the code from the codeunit into a function on the report, but I am having the same timeout issue with that approach.
We are stumped!
I want to call the code from a processing only report, but I keep getting sql timeouts after several minutes. When the codeunit is run directly it runs in about one second.
I have also tried to copy the code from the codeunit into a function on the report, but I am having the same timeout issue with that approach.
We are stumped!
0
Comments
-
Did you set this:
ADOConnection.CommandTimeout(0);
before calling the sp?
If you don't do it, the timeout of a command is a standard value (I think it is the value you find in the properties of the SQL-server=>Connections=>"Remote query timeout" but i am not sure. I never tested it).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Yes we have the timeout property set. As I said before the codeunit executes just fine, but when it's called from the report sql times out.
The code we're using is below://CREATE CONNECTION AND OPEN IF ISCLEAR(lADOConnection) THEN CREATE(lADOConnection); lADOConnection.ConnectionString:= 'Driver={SQL Server}; Server=EFORCE07\MSPOSINSTANCE;'+ 'Database=fromVBSO; UID=sa; PWD=xxxx'; lADOConnection.Open; IF ISCLEAR(lADOCommand) THEN CREATE(lADOCommand); lvarActiveConnection := lADOConnection; lADOCommand.ActiveConnection := lvarActiveConnection; //Execute Stored Procedure lADOCommand.CommandText := 'NAVPopulateTable' ; ADOParameter := lADOCommand.CreateParameter('@begindate', 200, 1, 10,BeginDate); lADOCommand.Parameters.Append(ADOParameter); ADOParameter := lADOCommand.CreateParameter('@enddate', 200, 1, 10,EndDate); lADOCommand.Parameters.Append(ADOParameter); lADOCommand.CommandType := 4; //Stored Procedure lADOCommand.CommandTimeout := 0; lADOCommand.Execute; //CLOSE CONNECTION lADOConnection.Close; CLEAR(lADOConnection);0 -
Did you set EndDate and BeginDate values?gfarrell wrote:Yes we have the timeout property set. As I said before the codeunit executes just fine, but when it's called from the report sql times out.
Are you sure that those values (both report and codeunit) are equal?Looking for part-time work.
Nav, T-SQL.0 -
Problem solved.
As long as I put a COMMIT just before calling the codeunit, the reports runs the codeunit without any problem.
Thanks everybody for your help.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
- 322 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