本文介绍了Plz修复错误我的商店程序'@Created参数未提供'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:-Procedure或函数'spAddVoucherCheck'需要参数'@CreatedAt',这是未提供的。



我的商店 - p名称spAddVoucherCheck



Error:-Procedure or function 'spAddVoucherCheck' expects parameter '@CreatedAt', which was not supplied.

My store-p Name spAddVoucherCheck

ALTER PROC [dbo].[spAddVoucherCheck]
 @xml xml,
@CreatedAt Varchar(200), @AccessBy int,
@error varchar(1000) output
AS
BEGIN
BEGIN TRY
DECLARE @MAXID as int;
SELECT @MAXID = ISNULL(MAX(ID), 0) FROM VoucherCheck;
INSERT INTO VoucherCheck(Title , CreatedAt ,CreatedOn,UpdatedOn,Status,CreatedBy,UpdatedBy,IPAddress
)
SELECT N.value('(Title)[1]', 'Varchar(MAX)') ,@CreatedAt,getdate(),getdate(),N.value('(Status)[1]', 'bit'),N.value('(CreatedBy)[1]', 'int'),N.value('(UpdatedBy)[1]', 'int'),N.value('(IPAddress)[1]', 'Varchar(50)') FROM @XML.nodes('/Table/VoucherCheck') as T(N);
DECLARE @SQL as Varchar(2000);
INSERT INTO VoucherCheckAccess (AccessAt, DataID, AccessBy)
SELECT @CreatedAt, T1.ID, @AccessBy FROM VoucherCheck T1 WHERE T1.ID > @MaxID;
END TRY
BEGIN CATCH
SET @Error = ERROR_NUMBER() + ' ' + ERROR_MESSAGE();
END CATCH
END

推荐答案

EXEC dbo.spAddVoucherCheck @CreatedAt='Hello', ...





BTW:名称@CreatedAt暗示这是基于日期的数据:如果是这样,那么不要将其存储为NVARCHAR - 而是使用DATETIME字段 - 它会使您以后对数据执行的所有操作变得更加容易。因此,SP的@CreatedAt参数也应该是DATETIME。



BTW: the name @CreatedAt implies this is date based data: if so then don't store it as NVARCHAR - use a DATETIME field instead - it makes everything you do with the data later a lot, lot easier. As a result, the @CreatedAt parameter to your SP should be DATETIME as well.


这篇关于Plz修复错误我的商店程序'@Created参数未提供'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 21:27