用户输入自己的记录时出现的错误 [英] bugs comming when user entry their own record

查看:77
本文介绍了用户输入自己的记录时出现的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友
我已经声明了静态类
两个或多个用户登录时发生问题
假设:
每个用户都在页面中创建自己的项目.当用户选择项目并将其显示在gridview透视视图状态中时,我这边是
gridveiw显示三重记录
因为它显示了他们创建自己的项目时登录的所有用户数据
数据彼此不匹配.....
plz ..........
解决方案.

hi friends
i have declared static class
problem occurred when two or more user logged in
suppose:
every user create their own item in the page. my side is when user select item and display it in gridview throgh view state
the gridveiw show double -triple records
because it show all user data that are logged in when they create their own items
the data is mismatching each-other.................
plz..........
solution.

推荐答案

规则是-不要使用静态类.

您需要使用实例,并将信息存储在cookie或Session中而不是类中.

静态的整个想法是每个应用程序只有一个-在ASP.NET中,这不是您可以使用的解决方案,因为两个用户可能无法共享一个应用程序,并且该应用程序很可能在一个用户被终止之前重新启动完成了.

在ASP中,应用程序在第一个用户开始使用它时启动,但是它可以(并且通常会在页面加载结束时结束)并在用户回发时重新加载.您不能将信息存储在静态类中,甚至不能期望同一用户可以使用它!
The rule is - don''t use static classes.

You need to use instances, and to store information either in cookies or in the Session instead of classes.

The whole idea of Static is that there is only one per application - in ASP.NET that is not a solution you can use, as two users may opr may not share an application, and the application may well be terminated and restarted before one user has finished with it.

In ASP, the application starts when the first user starts to use it, but it can (and often will) be ended at the end of that page load and be reloaded when the user does a post back. You can''t store information in a static class and expect it to even be available to the same user!


这篇关于用户输入自己的记录时出现的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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