如何在asp.net应用程序中查找在线朋友 [英] how to find online friends in my asp.net application

查看:52
本文介绍了如何在asp.net应用程序中查找在线朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个网站,我们可以在其中添加朋友..
我希望用户可以看到他的在线朋友如何执行此操作...

朋友的数据库表..

i have created a website in which we can add friends..
i want user can see his online friends how to do this...

database table of friends..

CREATE TABLE [dbo].[tbl_friendmaster](
	[i_autoid] [int] IDENTITY(1,1) NOT NULL,
	[Friendgroup] [varchar](50) NOT NULL,
	[Message] [varchar](500) NOT NULL,
	[i_Friendid] [int] NOT NULL,
	[i_myid] [int] NOT NULL,
	[approvalstatus] [int] NOT NULL,
	[CreateDate] [datetime] default getdate()  NOT NULL
)

推荐答案

根据我的理解,您必须将登录用户信息维护到数据库中.请执行以下步骤:

1.只要有任何用户登录,就将信息插入数据库.因此,当用户登录时表示用户在线,而在注销时表示用户离线.
注意:但是您必须在时间到期时做分析.假设用户未注销并关闭其浏览器,那么您将如何确定用户是否已注销(脱机).

2.根据好友列表中的信息设置状态,在10或15秒内定期调用数据库

谢谢
As per my understanding, you have to maintain Logged-In user information into database. Follow below steps:

1. Whenever any user logged-in then insert info into database. So when user logged-in then mean user is online and when logged-out mean user is offline.
Note: But you have to do analysis on time expire. Suppose user is not logged-out and closed his browser then how you will identify whether user is logged-out (offline).

2. Call periodically to database in 10 or 15 second and based on info set status in your friend list

Thanks


对于使用的所有命名约定以及是否还有其他详细信息,您的问题不是很清楚.假设这是唯一存储数据的表,并且遵循以下命名约定:
Your question is not very clear on all the naming conventions used and if any other details are there. Assuming this is the only table to store data and following naming convention means:
i_autoid = just an id  (No idea why you have it... not needed!)
i_Friendid = id of the friend of logged in user
i_myid = id of the logged in person



试试:



Try:

SELECT
  i_Friendid
FROM
  tbl_friendmaster
WHERE
  i_myid = @loggedInUserId


现在,以上查询给出了与登录用户有关的所有Friendid.现在,必须以其他方式(而不是通过此表)跟踪在线或离线的某人.您需要将跟踪的在线用户与查询结果一起使用,以获取 only 的在线朋友.

试试吧!


Now, above query gives all the friendid that are related to logged in user. Now, someone being online or offline must be tracked other way (and not through this table). You need to use the tracking online user with the query result to get only online friends.

Try!


这篇关于如何在asp.net应用程序中查找在线朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆