Insert using sp error

D

David C

I am getting an error "Procedure or function mc_insActivityHistory has too
many arguements specified." I cannot see the problem. Below is the
DataSource info. and below that is the actual sp.

InsertCommand="mc_insActivityHistory"

<InsertParameters>
<asp:QueryStringParameter Name="PeopleLinkID"
QueryStringField="plid" Type="Int32" />
<asp:parameter Name="ActivityCode" Type="Int16" />
<asp:parameter Name="ActivityDate" Type="DateTime" />
<asp:parameter Name="EnteredBy" Type="Int32" />
<asp:parameter Name="ActivityNotes" Type="String" />
</InsertParameters>

ALTER PROCEDURE [dbo].[mc_insActivityHistory]
@PeopleLinkID int,
@ActivityCode smallint,
@ActivityDate datetime,
@EnteredBy int,
@ActivityNotes nvarchar(MAX)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

INSERT INTO [MCFICore].[dbo].[ActivityHistory]
([PeopleLinkID]
,[ActivityCode]
,[ActivityDate]
,[EnteredBy]
,[ActivityNotes])
VALUES
(@PeoplelinkID,
@ActivityCode,
@ActivityDate,
@EnteredBy,
@ActivityNotes);

END


Thanks.
-David
 
S

Scott M.

David C said:
I am getting an error "Procedure or function mc_insActivityHistory has too
many arguements specified." I cannot see the problem. Below is the
DataSource info. and below that is the actual sp.

InsertCommand="mc_insActivityHistory"

<InsertParameters>
<asp:QueryStringParameter Name="PeopleLinkID"
QueryStringField="plid" Type="Int32" />
<asp:parameter Name="ActivityCode" Type="Int16" />
<asp:parameter Name="ActivityDate" Type="DateTime" />
<asp:parameter Name="EnteredBy" Type="Int32" />
<asp:parameter Name="ActivityNotes" Type="String" />
</InsertParameters>

ALTER PROCEDURE [dbo].[mc_insActivityHistory]
@PeopleLinkID int,
@ActivityCode smallint,
@ActivityDate datetime,
@EnteredBy int,
@ActivityNotes nvarchar(MAX)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

INSERT INTO [MCFICore].[dbo].[ActivityHistory]
([PeopleLinkID]
,[ActivityCode]
,[ActivityDate]
,[EnteredBy]
,[ActivityNotes])
VALUES
(@PeoplelinkID,
@ActivityCode,
@ActivityDate,
@EnteredBy,
@ActivityNotes);

END


Thanks.
-David

Does this table automatically create a unique ID as the primary key for the
data? If so, you shouldn't be passing it to the insert command, you should
just let the database create that field for you.

-Scott
 
D

David C

Scott M. said:
David C said:
I am getting an error "Procedure or function mc_insActivityHistory has too
many arguements specified." I cannot see the problem. Below is the
DataSource info. and below that is the actual sp.

InsertCommand="mc_insActivityHistory"

<InsertParameters>
<asp:QueryStringParameter Name="PeopleLinkID"
QueryStringField="plid" Type="Int32" />
<asp:parameter Name="ActivityCode" Type="Int16" />
<asp:parameter Name="ActivityDate" Type="DateTime" />
<asp:parameter Name="EnteredBy" Type="Int32" />
<asp:parameter Name="ActivityNotes" Type="String" />
</InsertParameters>

ALTER PROCEDURE [dbo].[mc_insActivityHistory]
@PeopleLinkID int,
@ActivityCode smallint,
@ActivityDate datetime,
@EnteredBy int,
@ActivityNotes nvarchar(MAX)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

INSERT INTO [MCFICore].[dbo].[ActivityHistory]
([PeopleLinkID]
,[ActivityCode]
,[ActivityDate]
,[EnteredBy]
,[ActivityNotes])
VALUES
(@PeoplelinkID,
@ActivityCode,
@ActivityDate,
@EnteredBy,
@ActivityNotes);

END


Thanks.
-David

Does this table automatically create a unique ID as the primary key for
the data? If so, you shouldn't be passing it to the insert command, you
should just let the database create that field for you.

-Scott
Yes it does. It is named ActivityID and is not sent as a parameter.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top