存储过程需要未指定的参数 [英] Stored procedure expects an parameter which was not specified
问题描述
我有一个表,用于存储姓氏,中间名和名字.我使用存储过程在这些列中插入值.但是对于那些名字没有中间名的人(例如Marry Jones,Laite Manuel等),当我单击插入"按钮时,存储过程将报告错误消息:它需要未指定的@MiddleName参数.我该如何解决?
该存储过程包含以下代码:
…
I have a table that stores last name, middle name and first name. I insert values in these columns using a stored procedure. But for those whose names doesn’t have middle name like Marry Jones, Laite Manuel, etc, when I click into insert button, the stored procedure reports an error saying: it expects @MiddleName parameter which was not specified. How can I solve this?
The stored procedure contains the following code:
…
@FirstName varchar(50),
@MiddleName varchar(50),
@LastName varchar(50)
AS
BEGIN
(
FirstName ,
MiddleName,
LastName
)
VALUES
(
@FirstName ,
@MiddleName,
@LastName
)
END
我的InsertNamesaspx页面包含一个插入按钮,一个insertReportLabel(标签)和以下文本框的ID名称:
My InsertNamesaspx page contain an insert button, an insertReportLabel (Label) and the following ID names of textboxes:
firstNameTexxBox – for editing first names;
middleNameTexxBox - for editing middle names;
lastNameTexxBox - for editing last names.
请帮忙.
Please help.
推荐答案
尝试一下:
Try this:
…
@FirstName varchar(50),
@MiddleName varchar(50) = NULL,
@LastName varchar(50)
AS
这篇关于存储过程需要未指定的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!