The call to member Execute failed. Timeout expired

pradeepkmr478
Member Posts: 13
I have to create a manpower report Deptwise, in this report working hours and production hours need to calculate.
working hour is the attendance of employee, which is captured in SaviorDatabase.
Production hours are uploaded in NavisionDatabase.
Means data need to fetch from different databases on the basis of DeptCode.
To achieve this have create a procedure in sql server. this is working
ALTER Procedure [dbo].[ManpowerLatest] (@FromDay int,@FromMon int,@FromYear int,@ToDay int,@ToMon int,@ToYear int,@CompCode Varchar(5))
As
BEGIN
Insert into ManPower1(PAYCODE,DepartmentCode,DepartmentName,isContractor,V_NET,VOT_AMT,VPRE)
Select EMP.PAYCODE,Emp.DepartmentCode,DepartmentName,isContractor,suM(isnull(pr.V_GROSS,0) +isnull(ARRV_Net,0)) V_NET,
SUM(isnull(VOT_AMT,0)) VOT_AMT,SUM(isnull(VPRE,0)) VPRE from pay_DAILY_result PR,TblEmployee Emp,TblCompany,
TblDepartment where PR.Mon_year between (Select Convert(Varchar,@FromYear)+'-'+Convert(Varchar,@FromMon)+'-'+Convert(Varchar,@FromDay))
AND (Select Convert(Varchar,@ToYear)+'-'+Convert(Varchar,@ToMon)+'-'+Convert(Varchar,@ToDay))
AND Emp.paycode=PR.PayCode and TblCompany.CompanyCode=Emp.CompanyCode and TblDepartment.DepartmentCode=Emp.DepartmentCode
And emp.Companycode =@CompCode Group by
EMP.PAYCODE,Emp.DepartmentCode,DepartmentName,isContractor
Insert Into Manpower2(PAYCODE,HOURSWORKED,OTDURATION)
(Select PAYCODE,Sum(HOURSWORKED),Sum(OTDURATION) from tblTimeRegister Where DATEOFFICE between
(Select Convert(Varchar,@FromYear)+'-'+Convert(Varchar,@FromMon)+'-'+Convert(Varchar,@FromDay))
AND (Select Convert(Varchar,@ToYear)+'-'+Convert(Varchar,@ToMon)+'-'+Convert(Varchar,@ToDay))
Group by PAYCODE )
Insert into Database..(PAYCODE,DepartmentCode,DepartmentName,isContractor,V_NET,VOT_AMT,VPRE,Hoursworked,OTDURATION)
Select MP1.PAYCODE,MP1.DepartmentCode,MP1.DepartmentName,MP1.isContractor,MP1.V_NET,MP1.VOT_AMT,MP1.VPRE,MP2.HOURSWORKED,MP2.OTDURATION
from ManPower1 MP1
Inner Join ManPower2 MP2 On MP2.PAYCODE=MP1.PAYCODE
Delete ManPower1
Delete ManPower2
END
Now i create a report and then call this procedure..........
CreateConnection;
ADO_Connection.Execute(STRSUBSTNO('EXEC ManpowerLatest '+FORMAT(FDate)+','+FORMAT(FMonth)+','+FORMAT(FYear)+','
+FORMAT(TDate)+','+FORMAT(TMonth)+','+FORMAT(TYear))+','''+CompCode+'''');
CloseConnection;
Now when i am running the report following error is populating. Sometime report get executed or most of time its shows error:--
Microsoft Dynamics NAV
This message is for C/AL programmers:
The call to member Execute failed. Microsoft OLE DB Provider for SQL Server returned the following message:
Timeout expired
OK
working hour is the attendance of employee, which is captured in SaviorDatabase.
Production hours are uploaded in NavisionDatabase.
Means data need to fetch from different databases on the basis of DeptCode.
To achieve this have create a procedure in sql server. this is working
ALTER Procedure [dbo].[ManpowerLatest] (@FromDay int,@FromMon int,@FromYear int,@ToDay int,@ToMon int,@ToYear int,@CompCode Varchar(5))
As
BEGIN
Insert into ManPower1(PAYCODE,DepartmentCode,DepartmentName,isContractor,V_NET,VOT_AMT,VPRE)
Select EMP.PAYCODE,Emp.DepartmentCode,DepartmentName,isContractor,suM(isnull(pr.V_GROSS,0) +isnull(ARRV_Net,0)) V_NET,
SUM(isnull(VOT_AMT,0)) VOT_AMT,SUM(isnull(VPRE,0)) VPRE from pay_DAILY_result PR,TblEmployee Emp,TblCompany,
TblDepartment where PR.Mon_year between (Select Convert(Varchar,@FromYear)+'-'+Convert(Varchar,@FromMon)+'-'+Convert(Varchar,@FromDay))
AND (Select Convert(Varchar,@ToYear)+'-'+Convert(Varchar,@ToMon)+'-'+Convert(Varchar,@ToDay))
AND Emp.paycode=PR.PayCode and TblCompany.CompanyCode=Emp.CompanyCode and TblDepartment.DepartmentCode=Emp.DepartmentCode
And emp.Companycode =@CompCode Group by
EMP.PAYCODE,Emp.DepartmentCode,DepartmentName,isContractor
Insert Into Manpower2(PAYCODE,HOURSWORKED,OTDURATION)
(Select PAYCODE,Sum(HOURSWORKED),Sum(OTDURATION) from tblTimeRegister Where DATEOFFICE between
(Select Convert(Varchar,@FromYear)+'-'+Convert(Varchar,@FromMon)+'-'+Convert(Varchar,@FromDay))
AND (Select Convert(Varchar,@ToYear)+'-'+Convert(Varchar,@ToMon)+'-'+Convert(Varchar,@ToDay))
Group by PAYCODE )
Insert into Database..(PAYCODE,DepartmentCode,DepartmentName,isContractor,V_NET,VOT_AMT,VPRE,Hoursworked,OTDURATION)
Select MP1.PAYCODE,MP1.DepartmentCode,MP1.DepartmentName,MP1.isContractor,MP1.V_NET,MP1.VOT_AMT,MP1.VPRE,MP2.HOURSWORKED,MP2.OTDURATION
from ManPower1 MP1
Inner Join ManPower2 MP2 On MP2.PAYCODE=MP1.PAYCODE
Delete ManPower1
Delete ManPower2
END
Now i create a report and then call this procedure..........
CreateConnection;
ADO_Connection.Execute(STRSUBSTNO('EXEC ManpowerLatest '+FORMAT(FDate)+','+FORMAT(FMonth)+','+FORMAT(FYear)+','
+FORMAT(TDate)+','+FORMAT(TMonth)+','+FORMAT(TYear))+','''+CompCode+'''');
CloseConnection;
Now when i am running the report following error is populating. Sometime report get executed or most of time its shows error:--
Microsoft Dynamics NAV
This message is for C/AL programmers:
The call to member Execute failed. Microsoft OLE DB Provider for SQL Server returned the following message:
Timeout expired
OK
Regards
Pradeep Bhardwaj
Pradeep Bhardwaj
0
Comments
-
Hi,
I would try using the ADO Command.
With the ADO command you have to set the different type of commands you are issueing:
Command Type
SQL commandtypeEnum-
adCmdText ,1 ,SQL String
adCMDTable ,2 ,Table
adCMDTableDirect ,512 ,Table
adCmdStoredProc ,4 , Stored Procedure
adCmdFile ,256 ,A Saved recordset.
adCmdUnknown ,8 ,Unknown command type
adAsyncExecute ,16 , Asynchronous Execution.
adAsyncFetch ,32 ,Asynchronous Execution
adAsyncFetchNonBlocking ,64, Async Fetching that does not block
adExecuteNoRecords, 128 ,for a Non-row returning command. A null recordset is returned.
Improves performance if you use this.
tsADOCommand 'Microsoft ActiveX Data Objects 2.8 Library'.Command Automation
With the ADO Command you can set the Timeout to anything you want.
here is an example how I used it:IF ISCLEAR(tsADOCommand) THEN CREATE(tsADOCommand); tsVarADOConnection := tsADOConnection; tsADOCommand.ActiveConnection := tsVarADOConnection; tsADOCommand.CommandText := 'master.dbo.tsGetLogFiles'; tsADOCommand.CommandType := 4; tsADOCommand.CommandTimeout := 0; tsADOCommand.Execute;
As you can see I set my command type to "Stored procedure (4)"
The Timeout is set to 0 which means that it waits until it completes.
I hope this helps,
Regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.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