Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Comments
You want to insert the Employee Name through this proc, right?

Or what is your question? It's not clear.
s_rao88 9-Jul-13 2:06am    
u dnt neeed to downvote if u havent understud d question..
For your information, I have not downvoted your question.
Before I commented here, it was already downvoted.
s_rao88 9-Jul-13 2:08am    
i want to insert employee details through employee name .. r else as login user id...
Prasad Khandekar 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

try something like
SQL
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)
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900