Hi ,
Can anyone explain what is the difference between web app and windows app using static variable in terms of multiuser access?
Thanks,
Popskie
Printable View
Hi ,
Can anyone explain what is the difference between web app and windows app using static variable in terms of multiuser access?
Thanks,
Popskie
There is no difference. A static member is a member of a class, not an instance of a class.
The difference that you perceive is that with a Windows application there would rarely be more than one instance of your application running on a system at once. With a Web app the same system is serving multiple users much of the time, so your static members are shared by all those users.
I approved of what you said JM. Thanks
So, if posible its better to avoid using static in a web app. Am I right? Actually JM this app is already live in production but where lucky that until now its only one user used this site.hehehe
Again thanks.
I don't know exactly how you're using it but many people abuse the static key word. If you've assigned a connection to a static variable in a class that may be used by more than one caller then that's a problem. A static variable is one for which there is, and should only be, one instance for the entire class. If you're making multiple connections then it's not logical that there should only be a single connection object.
Ok jm your right.