Sivakumar

Sivakumar

  • NA
  • 551
  • 217.8k

How can i get multiple table values using id

Aug 24 2015 8:01 AM
Hi, how can get values from multiple tables based on id using stored procedure
 
this is my tables :

 
 
i want to get TeamMember Details using TeamId.using linq to sql stored procedure.
 this is my stored procedure:
GO
ALTER PROCEDURE [dbo].[uspGetAllTeamMembers](@TeamID INT)

AS

BEGIN


SELECT m.MemberID,

m.MemberName,

m.MemberStatus,

ml.MemberLoginName,

tm.MemberJoinedDate,

tm.MemberLeftDate


FROM TeamMember tm

INNER JOIN MemberLogin ml

ON tm.MemberLoginID = ml.MemberLoginID

INNER JOIN Member m

ON m.MemberID = ml.MemberLoginID

WHERE tm.TeamID = @TeamID


END
and backend code is like this :
public TeamMemberData GetAllTeamMembers(int teamid)
{
Member getteammember = _DataContext.uspGetAllTeamMembers(teamid).SingleOrDefault();
return new TeamMemberData { MemberName=getteammember.MemberName, MemberLoginID=getteammember.};
 
this is correct if not give me a help please.
 

Answers (6)