943,949 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 1648
  • ASP.NET RSS
Mar 10th, 2008
0

problem with insert statement

Expand Post »
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:
ASP.NET Syntax (Toggle Plain Text)
  1. create PROCEDURE [dbo].[AssignAndStore]
  2. -- Add the parameters for the stored procedure here
  3. @name varchar(50),
  4. @TaskAssigned nvarchar(50),
  5. @TimeAssigned nvarchar(50)
  6. AS
  7. BEGIN
  8. -- SET NOCOUNT ON added to prevent extra result sets from
  9. -- interfering with SELECT statements.
  10. SET NOCOUNT ON;
  11.  
  12.  
  13. --insert query
  14. insert into Employee(TaskAssigned,TimeAssigned)
  15. values (@TaskAssigned,@TimeAssigned)
  16. WHERE name = @name
  17. --im getting error with where clause
  18.  
  19. END
im using dropdwn list for task and name and textbox for time.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
waterfall is offline Offline
24 posts
since Nov 2007
Mar 10th, 2008
0

Re: problem with insert statement

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
Reputation Points: 23
Solved Threads: 16
Posting Whiz in Training
plazmo is offline Offline
206 posts
since Aug 2005
Mar 11th, 2008
0

Re: problem with insert statement

thanx alot. it solved my problem.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
waterfall is offline Offline
24 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Retaining GridView data which was selected with checkbox click,to the next page in AS
Next Thread in ASP.NET Forum Timeline: Auto Email Reminder





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC