我想插入数据时出现sqlException问题 [英] sqlException problem when i want to insert data

查看:72
本文介绍了我想插入数据时出现sqlException问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.
我用一些存储过程写了一个Inser语句,

Hi.
i have writen an Inser statement with some stored procedures ,

Create PROCEDURE [dbo].[Insert_Person_SP](
@PersonelCode nvarchar(20),
@NonIranPersonId int,
@SodourCityId int,
@CityId int ,
--@MazhabId int,
@GenderId int,
@MilitaryStatusId int,
@MaritialStatusId int,
@IsEmployee bit,
@IsTeacher bit, 
--@JobTitle nvarchar(50),
--@JobDescribtion nvarchar(500),
@LastName nvarchar(60),
@FirstName nvarchar(60),
@FatherName nvarchar(50),
--@NationalityId
@BirthDate_S date,
@SerialNumber nvarchar(50),
@NationalNumber nvarchar(10),
@PostalCode nvarchar(10),
@Phone nvarchar(25),
@Mobile nvarchar(20),
@HomeAddress nvarchar(300),
@Email nvarchar(50)
--@Photo
--@PhotoPath

)
AS
begin
Insert into Persons(
PersonelCode,
NonIranPersonId,
SodourCityId,
CityId,
--MazhabId,
GenderId,
MilitaryStatusId,
MaritialStatusId,
IsEmployee,
IsTeacher,
--JobTitle,
--JobDescribtion
LastName,
FirstName,
FatherName,
--NationalityId
BirthDate_S,
SerialNumber,
NationalNumber,
PostalCode,
Phone,
Mobile,
HomeAddress,
Email
--Photo
--PhotoPath
)
values(
@PersonelCode,
@NonIranPersonId,
@SodourCityId,
@CityId,
--MazhabId,
@GenderId,
@MilitaryStatusId,
@MaritialStatusId,
@IsEmployee,
@IsTeacher,
--JobTitle
--JobDescribtion
@LastName,
@FirstName,
@FatherName,
--NationalityId
@BirthDate_S,
@SerialNumber,
@NationalNumber,
@PostalCode,
@Phone,
@Mobile,
@HomeAddress,
@Email
--Photo
--PhotoPath

)
select @@Identity
end



但是每当我调试解决方案时,就会出现此异常:
SqlException被捕获
过程或函数Insert_Person_SP指定了太多参数.

你知道是什么问题.



but whenever i debug the solution this exception appeares:
SqlException was caught
Procedure or function Insert_Person_SP has too many arguments specified.

do you konw what is the problem .

thanks in advance.

推荐答案

过程或函数Insert_Person_SP指定了太多参数.
此错误并不表示您在使用SP时遇到问题.这仅表示被调用的SP具有参数编号不匹配.当前,您已经定义了20个用于执行SP的参数.看起来,当您从应用程序中调用时,您传递的参数超过20个,以调用此SP.
Procedure or function Insert_Person_SP has too many arguments specified.
This error does not say you have issue with SP. It simply means, the SP called has parameter number mismatch. Currently, you have 20 parameters defined for SP to get executed. It looks like when you call from your application, you are passing more parameters than 20 to call this SP.


这篇关于我想插入数据时出现sqlException问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆