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.

You dont need a where for an insert because your not filtering out data, its a new record to the table. only an update, select or delete statements need a where clause.

You probably meant to do
update Employee
SET TaskAssigned=@TaskAssigned,
TimeAssigned=@TimeAssigned
WHERE name = @name

Also, id recommend assigning an identity ID to each employee and updating using the id

thanx alot. it solved my problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.