hi, im using VS.net 2005 for developing a web application.im using stored procedure for inserting records into database.i want to insert time and task for a selcetd employee but its not working. kindly help me.her's my stored procedure:

create PROCEDURE [dbo].[AssignAndStore] 
	-- Add the parameters for the stored procedure here
	@name varchar(50),
@TaskAssigned nvarchar(50),
@TimeAssigned nvarchar(50)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

 
--insert query
insert into Employee(TaskAssigned,TimeAssigned)
values (@TaskAssigned,@TimeAssigned)
      WHERE  name  = @name
--im getting error with where clause

END

im using dropdwn list for task and name and textbox for time.

I don't have something in which I can say that's the problem I am not sure but try to be sure from column names like 'name'.
Trace the parameters sent to this SP if it works!
Send me the error raised to help you.

I tried answering this morning, but the network connection failed. Sorry for being late :)

The Insert statement does not allow a Where clause.
I will assume that your Employee table has a column named "EmployeeName" or some place to put the name value. It would not make sense to place a task against an employee without also telling the database which employee the task is assigned.

I have revised the proc for you below.

Regards,
Jerry

create PROCEDURE [dbo].[AssignAndStore] 
	@name varchar(50),
@TaskAssigned nvarchar(50),
@TimeAssigned nvarchar(50)
AS
BEGIN
 
insert into Employee(EmployeeName,TaskAssigned,TimeAssigned)
values (@name,@TaskAssigned,@TimeAssigned)

END

my problem has been solved.i used update query instead of insert.

This question has already been answered. Start a new discussion instead.