TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thamsanqa Ngcongwane
NA
184
24.9k
Procedure or function has too many arguments specified
Oct 11 2019 12:57 AM
How to resolve the error above. Your help will be highly appreciated.
My HTML:
<div
class
=
"form-group"
>
<div
class
=
"input-group"
>
<span asp-validation-
for
=
"Item2.DocumentName"
class
=
"text-danger input-group-addon"
>CV</span>
<input asp-
for
=
"Item2.DocumentName"
type=
"file"
class
=
"form-control"
placeholder=
"Attach CV"
name=
"DocumentName"
>
</div>
</div>
<div
class
=
"form-group"
>
<div
class
=
"input-group"
>
<span asp-validation-
for
=
"Item2.DocumentNameTwo"
class
=
"text-danger input-group-addon"
>ID</span>
<input asp-
for
=
"Item2.DocumentNameThree"
type=
"file"
class
=
"form-control"
placeholder=
"Attach ID Copy"
name=
"DocumentNameTwo"
>
</div>
</div>
<div
class
=
"form-group"
>
<div
class
=
"input-group"
>
<span asp-validation-
for
=
"Item2.DocumentNameThree"
class
=
"text-danger input-group-addon"
>Qualification</span>
<input asp-
for
=
"Item2.DocumentNameThree"
type=
"file"
class
=
"form-control"
placeholder=
"Attach Qualification"
name=
"DocumentNameThree"
>
</div>
</div>
</div>
My Stored Procedure:
ALTER
PROCEDURE
[dbo].[sp_Documents]
(@UserID
int
=
null
,@DocumentName
varchar
(
MAX
) =
null
,@Description
varchar
(
MAX
) =
null
,@DocTypeID
int
=
null
,@DocURL
varchar
(
MAX
) =
null
)
AS
INSERT
INTO
[dbo].[Documents]
([UserID]
,[DocumentName]
,[Description]
,[DocTypeID]
,[DocURL]
--,[CreatedBy]
--,[DateUpdated]
--,[UpdatedBy]
--,[DateDeleted]
--,[DeletedBy]
--,[DeleteREason]
)
VALUES
(@UserID
,@DocumentName
,@Description
,@DocTypeID
,@DocURL
--,@CreatedBy bigint
--,@DateUpdated datetime
--,@UpdatedBy bigint
--,@DateDeleted datetime
--,@DeletedBy bigint
--,@DeleteREason varchar(max)
)
My C# code:
conn.Open();
cmd2.CommandType = CommandType.StoredProcedure;
//Save Attachment Data for CV
document.DocURL =
"~/Documents/"
;
cmd2.Parameters.AddWithValue(
"@UserID"
, (document.UserID));
cmd2.Parameters.AddWithValue(
"@DocumentName"
, (document.DocumentName));
cmd2.Parameters.AddWithValue(
"@Description"
,
"CV"
);
cmd2.Parameters.AddWithValue(
"@DocURL"
, document.DocURL + document.DocumentName);
//cmd2.ExecuteNonQuery();
//Second Attachment
if
(document.DocumentName != document.DocumentNameTwo)
{
document.DocURL =
"~/Documents/"
;
document.DocumentName = document.DocumentNameTwo;
cmd2.Parameters.AddWithValue(
"@UserID"
, (document.UserID));
cmd2.Parameters.AddWithValue(
"@DocumentName"
, (document.DocumentName));
cmd2.Parameters.AddWithValue(
"@Description"
,
"ID Copy"
);
cmd2.Parameters.AddWithValue(
"@DocURL"
, document.DocURL + document.DocumentName);
}
if
(document.DocumentName != document.DocumentNameThree) {
document.DocURL =
"~/Documents/"
;
document.DocumentName = document.DocumentNameThree;
cmd2.Parameters.AddWithValue(
"@UserID"
, (document.UserID));
cmd2.Parameters.AddWithValue(
"@DocumentName"
, (document.DocumentName));
cmd2.Parameters.AddWithValue(
"@Description"
,
"Qualification"
);
cmd2.Parameters.AddWithValue(
"@DocURL"
, document.DocURL + document.DocumentName);
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.ExecuteNonQuery();
conn.Close();
}
else
{
return
"Files Not Saved"
; }
Reply
Answers (
4
)
Desktop monitoring application
Unit test cases