| | |
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 3.5 ajax alltypeofvideos appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form gridview gudi iis image javascript list listbox menu mouse mssql nameisnotdeclared news novell numerical opera order parent problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security select serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview typeof validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xsl





