Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP SQL-Server
Hello All,
 
I have got to insert employee details in EditProfile page of my project, it should be like the employee who logs in can edit his profile and insert the details and once he inserts, data will get stored in database and next time he/she logs in, their details should get display in home page depending on their respective user id n passwrd..
 
i have done most of the things , but im not able to get the employee name while inserting d datas in edit profile... i mean to say that i one employee logs in n edits his/her profile data gets saved in database but not with the respective employee name...
 
i have tried stored procedure to insert the values to employee data but i dnt no wer to use emp name in tht.. plz help me... below is my stored procedure
 
ALTER PROCEDURE [dbo].[InsertProfile]
 
@Full_Name nvarchar(50),
@Add nvarchar(50),
@M_Num bigint,
@Mail_ID nvarchar(50),
@B_Group nvarchar(50),
 
@EmpID bigint OUTPUT
 

AS
 

Insert Into dbo.EmployeeData
(
FullName,
Address,
MobileNumber,
EmailID,
BloodGroup
)
 
Values 
(@Full_Name,
@Add,
@M_Num,
@Mail_ID,
@B_Group
)
 
Select @EmpID = SCOPE_IDENTITY();
Posted 8-Jul-13 20:43pm
s_rao88866
Comments
Tadit Dash at 9-Jul-13 1:57am
   
You want to insert the Employee Name through this proc, right?
 
Or what is your question? It's not clear.
s_rao88 at 9-Jul-13 2:06am
   
u dnt neeed to downvote if u havent understud d question..
Tadit Dash at 9-Jul-13 2:35am
   
For your information, I have not downvoted your question.
Before I commented here, it was already downvoted.
s_rao88 at 9-Jul-13 2:08am
   
i want to insert employee details through employee name .. r else as login user id...
Prasad Khandekar at 9-Jul-13 2:20am
   
From where you are not able to get the name? Is your edit profile page has a placeholder (textbox) for entering full name, if so then you can make that field mandatory and use that.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try something like
ALTER PROCEDURE [dbo].[InsertProfile]
 
@Full_Name nvarchar(50),
@Add nvarchar(50),
@M_Num bigint,
@Mail_ID nvarchar(50),
@B_Group nvarchar(50),
 
@EmpID bigint OUTPUT
 --ADD THIS 
CREATE TABLE #tempSubscriber
	(
	ID INT,
	[EMPNAME] nvarchar(50)
	}
 
AS
 
 
Insert Into dbo.EmployeeData
(
    FullName,
    Address,
    MobileNumber,
    EmailID,
    BloodGroup
)
 
Values 
(
    @Full_Name,
    @Add,
    @M_Num,
    @Mail_ID,
    @B_Group
)
 
INSERT INTO #tempSubscriber
(ID,[EMPNAME]) VALUES (SCOPE_IDENTITY(),@Full_Name)
Select * FROM #tempSubscriber
 
Here you need to create a #Table (HASHTABLE)
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 9 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100