| | |
problem with insert statement
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
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
Views: 1245 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn chat checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





