Insert using sp error

  • Thread starter Thread starter David C
  • Start date Start date
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
 
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
 
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
 
Back
Top