| | |
problem with insert statement
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 24
Reputation:
Solved Threads: 0
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:
im using dropdwn list for task and name and textbox for time.
ASP.NET Syntax (Toggle Plain Text)
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
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
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
![]() |
Similar Threads
- Insert Dataset into SQL Database. (VB.NET)
- insert multiple rows in database (MS SQL)
- Its really a problem on INSERT statement (MySQL)
- SQL problem - table names as variables (MS SQL)
- Access INSERT problem (MS Access and FileMaker Pro)
- ADO data control problem (Visual Basic 4 / 5 / 6)
Other Threads in the ASP.NET Forum
- Previous Thread: online exam
- Next Thread: Auto Email Reminder
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript listbox login microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





