| | |
insert statement problem
Please support our C# 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.
C# 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
I don't have something in which I can say that's the problem I am not sure but try to be sure from column names like 'name'.
Trace the parameters sent to this SP if it works!
Send me the error raised to help you.
Trace the parameters sent to this SP if it works!
Send me the error raised to help you.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: Nov 2006
Posts: 436
Reputation:
Solved Threads: 72
I tried answering this morning, but the network connection failed. Sorry for being late
The Insert statement does not allow a Where clause.
I will assume that your Employee table has a column named "EmployeeName" or some place to put the name value. It would not make sense to place a task against an employee without also telling the database which employee the task is assigned.
I have revised the proc for you below.
Regards,
Jerry
The Insert statement does not allow a Where clause.
I will assume that your Employee table has a column named "EmployeeName" or some place to put the name value. It would not make sense to place a task against an employee without also telling the database which employee the task is assigned.
I have revised the proc for you below.
Regards,
Jerry
C# Syntax (Toggle Plain Text)
create PROCEDURE [dbo].[AssignAndStore] @name varchar(50), @TaskAssigned nvarchar(50), @TimeAssigned nvarchar(50) AS BEGIN insert into Employee(EmployeeName,TaskAssigned,TimeAssigned) values (@name,@TaskAssigned,@TimeAssigned) END
![]() |
Similar Threads
- Insert Dataset into SQL Database. (VB.NET)
- insert multiple rows in database (MS SQL)
- Its really a problem on INSERT statement (MySQL)
- MySQL 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 C# Forum
- Previous Thread: Need design help for commission payout system
- Next Thread: Print in client system
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combo combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees developer development draganddrop drawing encryption enum equation event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mouseclick mysql nargalax operator path photoshop picturebox pixelinversion post programming radians regex remote remoting restore richtextbox save saving serialization server sleep socket sql stack statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






