@ParentID 不是过程 insertdepart 的参数。
我在调用用存储过程时报@ParentID 不是过程 insertdepart 的参数。;
存储过程:
create proc insertdepart
@Depproot int,
@DeppName nvarchar(20),
@deppdesc nvarchar(20)
as
declare @a integer
select @a=count(*) from new_department where Depproot =@Depproot and DeppName=@DeppName
if @a > 0
Begin
return 0
End
Else
Begin
insert into new_department(Depproot,DeppName,Deppdesc) Values(@Depproot,@DeppName,@DeppDesc)
return 1
end
调用代码:
SqlConnection con = CreateCon();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "insertdepart ";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
SqlParameter[] paras ={
new SqlParameter( "@ParentID ",SqlDbType.Int),
new SqlParameter( "@Deparname ",SqlDbType.NVarChar,30),
new SqlParameter( "@DartDesc ",SqlDbType.NVarChar,20),
new SqlParameter( "@RetValue ",SqlDbType.Int)