简体   繁体   English

如何在ASP.NET中为从同一页面访问的不同数据库设置访问者总数?

[英]How to Set the Total Visitors count in ASP.NET for different Databases that are accessed from same Page?

I am having a Search.aspx page which is going to display the records from user entered search criteria. 我有一个Search.aspx页面,它将显示用户输入的搜索条件中的记录。 It get the connects to the Specific Database amongst 50 SQLServer Databases . 它可以连接到50个SQLServer数据库中的特定数据库 Depending upon the QueryString passed ie Search.aspx?ID=1 it will connect to 1MyDB Database. 根据传递的QueryString,即Search.aspx?ID = 1 ,它将连接到1MyDB数据库。 if Search.aspx?ID=2 then connect to 2MyDB database which reside on same or different server.This works fine. 如果Search.aspx?ID = 2然后连接到位于相同或不同服务器上的2MyDB数据库。

The problem i need to display the total count of visitors depending upon the querystring in URL . 我需要根据URL中querystring显示访问者总数的问题。 for these Different Databases that are accessed from same page ie Search.aspx 用于从同一页面(即Search.aspx)访问的这些不同数据库

Plz suggest me the best method to get the total Visitors for that specific ID. Plz建议我最好的方法来获取该特定ID的访问者总数。

Whether to Store it in DB by creating a new table and insert the count. 是否通过创建新表并插入计数将其存储在数据库中。 OR Set about 50 Application Variables in Global.asax file and get the counter accordingly. 或在Global.asax文件中设置大约50个应用程序变量,并相应地获取计数器。

Help Appreciated...! 帮助赞赏...!

50 variables doesn't look good. 50个变量看起来不太好。 You're going to have a lot of work to show it, and you have to change the code if you add another database. 您将需要做很多工作来展示它,并且如果添加另一个数据库,则必须更改代码。 A table is better. 桌子比较好。 Create a table with id and count fields, and every time a page is being hit check if the id is already in the table. 创建一个具有id和count字段的表,每次单击页面时,都要检查ID是否已在表中。 If so, increase the row count field. 如果是这样,请增加行计数字段。 If not, add the id with count = 1. 如果不是,则添加count = 1的ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM