简体   繁体   中英

@Parameter1 is not a parameter for procedure

ALTER PROCEDURE [dbo].[NST_InsertTblGenLedDet]
        @GHDHeader int,
      @Gldtype text,
      @GldAccount text,
      @GldDate DateTime, 
      @GldVoucherType int,
      @GldDebit   float=null,
      @GldCredit float= null,
      @GldDtaLine int= null
AS
DECLARE @ERR INT
BEGIN TRANSACTION
Insert into [TblGenLedDet] 
(GHDHeader,Gldtype,GldAccount,GldDate, GldVoucherType, GldDebit,GldCredit,GldDtaLine)
 values (@GHDHeader,@Gldtype,@GldAccount,@GldDate, @GldVoucherType, @GldDebit,@GldCredit,@GldDtaLine)



SET @ERR = @@Error
IF @ERR = 0   
BEGIN
      COMMIT TRANSACTION

END
ELSE
BEGIN
      ROLLBACK TRANSACTION
      RETURN @ERR               
END

在此输入图像描述

I am getting this error again and again though i have specified the parameter name as @GldCredit it shows Parameter name as Parameter1

In your code, you initialize gldCredit , but then update gldDebit . Your gldCredit parameter never has any of its members set, and thus, has its ParaameterName defautled to "@Paremeter1" .

It looks like you copy/pasted the gldDebit code for setting up your parameter, but forgot to update all the references in the new block of code to point to gldCredit .

Sharing for future readers -

This error is also thrown when the @ParameterName in your C# code is different than @Parameter_Name in stored-procedures .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM