正常に動作し、適切な結果を返す SQL クエリがあります
DECLARE @memberId DECIMAL
SET @memberId=100
SELECT S.ID,
S.STATUSDATE,
S.STATUSTEXT,
P.FIRSTNAME,
P.LASTNAME,
P.PHOTO
FROM MEMBERSTATUS S
JOIN PROFILE P
ON S.SENDERID = P.MEMBERID
WHERE S.SENDERID IN (SELECT F.MEMBERID AS ID
FROM MEMBER_FRIENDREQUEST F
WHERE ( F.FRIENDID = @memberId )
AND F.STATUS = 2
UNION
SELECT F.FRIENDID AS ID
FROM MEMBER_FRIENDREQUEST F
WHERE ( F.MEMBERID = @memberId )
AND F.STATUS = 2
UNION
SELECT @memberId)
しかし、ASP.NETで使用しようとすると、結果が返されません
using (var db = new ExerciseProgramManagerEntities())
{
var pMmemberId = new SqlParameter("@memberId", senderId);
var result = db.ExecuteStoreQuery<DynamicObject>("select s.Id, s.StatusDate, s.StatusText, p.FirstName, p.LastName, p.Photo "+
"from MemberStatus s join Profile p on s.SenderId = p.MemberID " +
"where s.SenderId IN "+
"("+
"select f.MemberID as id from Member_FriendRequest f where (f.FriendID = @memberId ) and f.Status=2 "+
"union "+
"select f.FriendID as id from Member_FriendRequest f where (f.MemberID=@memberId) and f.Status=2 " +
"union "+
"select @memberId)", pMmemberId);
クエリの何が問題になっていますか?