4
Answers

i Getting 'System.InvalidCastException' error

Sivakumar

Sivakumar

9y
260
1
Hi,
I get an error like this :
An exception of type 'System.InvalidCastException' occurred in System.Data.dll but was not handled in user code

Additional information: Specified cast is not valid.
this is my table structure:
and my stored procedure is :
ALTER PROCEDURE [dbo].[uspGetAllTeamMembers](@TeamID INT)

AS

BEGIN


SELECT
tm.TeamID,
m.MemberID,

m.MemberName,

m.MemberStatus,

ml.MemberLoginName,
ml.MemberLoginID,

tm.MemberJoinedDate,

tm.MemberLeftDate


FROM TeamMember tm

INNER JOIN MemberLogin ml

ON tm.MemberLoginID = ml.MemberLoginID

INNER JOIN Member m

ON m.MemberID = ml.MemberID

WHERE tm.TeamID = @TeamID


END
this is my backend code like this :
public TeamMemberData GetAllTeamMembers(int teamID)
{
TeamMember getteammember = _DataContext.uspGetAllTeamMembers(teamID).SingleOrDefault();
return new TeamMemberData { TeamID=getteammember.TeamID, MemberLoginID=getteammember.MemberLoginID};

}
i want to get aa team members details based on teamid
please give me a help
Thank You
Answers (4)