Calling stored Procedure From navision!!!

HanenHanen Member Posts: 281
Hello everybody,

Anyone can help me with this???
That's my sql Code :

GO
set ANSI_NULLS ON
GO
set QUOTED_IDENTIFIER ON
GO
IF OBJECT_ID ('dbo.PSExcel_BI013','P') IS NOT NULL
DROP PROCEDURE dbo.PSExcel_BI013
GO
CREATE PROCEDURE [dbo].[PSExcel_BI013]
/********************************* LES PARAMETRES DU FILTRE *******************************/
@CustomerNo1 AS VARCHAR(20),  
@CustomerNo2 AS VARCHAR(20), 
@MinDate AS  smalldatetime ,
@MaxDate AS smalldatetime


AS
BEGIN 

EXEC sp_makewebtask 
@outputfile = 'c:\Test\Statistiques.xls', 	
@query = [EXEC PSBI013 @CustomerNo1, @CustomerNo2, @MinDate, @MinDate  ],	
@colheaders =1, 	
@FixedFont=0,	
@lastupdated=1,    
@resultstitle='Statistiques Globales'

END


and that's my CAL code in navision:
ExecuteSP(VAR Code1 : Code[20];VAR code2 : Code[10];VAR StartDate : Date;VAR EndDate : Date;VAR ChaineConnection : Text[1000])

IF ISCLEAR(lADOConnection) THEN CREATE(lADOConnection);
lADOConnection.ConnectionString:=ChaineConnection;
lADOConnection.Open;
//***************************** Execute SP *************************
CustomerNo1:= Code1;
CustomerNo2:=code2;
MinDate:= StartDate;
MaxDate:= EndDate;

lADOConnection.Execute(STRSUBSTNO('EXEC PSExcel_BI013 ''%1'',''%2'',''%3'',''%4''', CustomerNo1, CustomerNo2, MinDate, MaxDate));

//***************************** Close sql connection *********************

lADOConnection.Close;
CLEAR(lADOConnection);

When I call my stored Procedure I got that error message :(
@CustomerNo1 must be declared

How can I do that in the right way.
Regards

Hanen TALBI

Comments

Sign In or Register to comment.