I'm developing a social networking site where i'm facing problem when sending Friend Request from one user to another....The problem is that FriendRequest shows `` to every user not only to whom it send so i want to show that request to whom it send eg: A send request to B so only B can see that request on FriendRequests.aspx just like facebook
I have these two pages
Database table : FriendRequest.dbo
In People.aspx.....Subsonic Tool used...
FriendRequest obj = new FriendRequest();
obj.IsNew = true;
obj.Uid = Convert.ToInt32(Session["UserID"]);
obj.IsFriend = false;
obj.Save();
In FriendRequets.aspx
if (!IsPostBack)
{
if (Session["UserID"] != null)
{
Response.Write(Session["FID"].ToString());
DataTable dt = Helper.ExecutePlainQuery("select * from UserRegistration inner join Profile on UserRegistration.uid=Profile.uid inner join FriendRequest on UserRegistration.uid=FriendRequest.uid");
repeater1.DataSource = dt;
repeater1.DataBind();
}
In database table FriendRequest.dbo
ReqID int primary
uid int Foreign
isFriend bit
The design of these two pages just looks like facebook "People you may know" page and "Friend Requests" page
Your query should looke like this:
"SELECT * FROM UserRegistration
INNER JOIN Profile on UserRegistration.uid=Profile.uid
INNER JOIN FriendRequest on UserRegistration.uid=FriendRequest.uid
WHERE ReqID= " + obj.Uid
by using WHERE
you are filtering the result to only the ones where the ReqID
matched the logged in user. On the assumption that ReqID
is the person uid
wants to be friends with.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.