Home All Groups Group Topic Archive Search About

Trying to set stored procedure parameter for sqldatasource in formview (edit mode)

Author
10 Feb 2006 2:42 AM
Eric W. Holzapfel
Hello WebControl Group,


I am trying to update a record in a database using the stored proc
below.  the asp.net 2.0 source code has the the parameters below
including the one for @recid (as "recid"). the procedure will not run,
it returns a "to many parameters" error.  if I delete the ref to
"recid", then the program states that the paramter "@recid" was not
supplied to the stored procedure.  What am I missing here?

Thanks,

eric

I have a stored procedure (see) below:
if exists (select * from sysobjects where id = object_id(N'sp_update_time')
and OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE sp_update_time
GO

CREATE PROCEDURE sp_update_time
@recid int,
@contact VARCHAR(50),
@job_name varchar(55),
@job_desc text,
@job_hours decimal(4,2),
--@tech_id int,
@job_date datetime,
--@date_entered datetime,
@comments text,
@billable bit

AS
UPDATE timetable SET

    contact = @contact,
    job_name = @job_name,
    job_desc = @job_desc,
    job_hours = @job_hours,
    job_date = @job_date,
    -- date entered not required for update - this is the date the
    -- user entered the data for first time
    -- date_entered = @date_entered,
    comments = @comments,
    billable = @billable

WHERE idx = @recid

/* test execute string below:
    exec sp_update_time 39, 'bill','test job name','test job
desc',1.5,'2005-12-16',
     '2006-1-1','test comments',true */

Author
11 Feb 2006 2:42 AM
Vince Varallo
You need parenthesis in your stored procedure.
CREATE PROCEDURE sp_update_time(
@recid int,
@contact VARCHAR(50),
@job_name varchar(55),
@job_desc text,
@job_hours decimal(4,2),
@job_date datetime,
@comments text,
@billable bit
)
AS

I'd also get rid of the commented params
Just a guess

Show quoteHide quote
"Eric W. Holzapfel" wrote:

> Hello WebControl Group,
>
>
> I am trying to update a record in a database using the stored proc
> below.  the asp.net 2.0 source code has the the parameters below
> including the one for @recid (as "recid"). the procedure will not run,
> it returns a "to many parameters" error.  if I delete the ref to
> "recid", then the program states that the paramter "@recid" was not
> supplied to the stored procedure.  What am I missing here?
>
> Thanks,
>
> eric
>
> I have a stored procedure (see) below:
> if exists (select * from sysobjects where id = object_id(N'sp_update_time')
> and OBJECTPROPERTY(id, N'IsProcedure') = 1)
> DROP PROCEDURE sp_update_time
> GO
>
> CREATE PROCEDURE sp_update_time
> @recid int,
> @contact VARCHAR(50),
> @job_name varchar(55),
> @job_desc text,
> @job_hours decimal(4,2),
> --@tech_id int,
> @job_date datetime,
> --@date_entered datetime,
> @comments text,
> @billable bit
>
> AS
> UPDATE timetable SET
>    
>     contact = @contact,
>     job_name = @job_name,
>     job_desc = @job_desc,
>     job_hours = @job_hours,
>     job_date = @job_date,
>     -- date entered not required for update - this is the date the
>     -- user entered the data for first time
>     -- date_entered = @date_entered,
>     comments = @comments,
>     billable = @billable
>    
> WHERE idx = @recid
>
> /* test execute string below:
>     exec sp_update_time 39, 'bill','test job name','test job
> desc',1.5,'2005-12-16',
>      '2006-1-1','test comments',true */
>