如何在c#桌面应用程序中创建会话? [英] How to create sessions in c# desktop applications?

查看:83
本文介绍了如何在c#桌面应用程序中创建会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,
我想在带有SQL2008数据库的C#桌面应用程序中创建会话.我想存储已登录用户的信息,例如-用户名,时间,access_permissions,user_email等.
我是新手,需要一些使用该应用程序存储和访问用户信息的帮助.


谢谢与问候
Saurabh Mahajan

Sir,
I want to create session in C# desktop application with SQL2008 Database. I would like to store the information of the user logged in like - user_name, time, access_permissions, user_email and so on.
I am a fresher and need some help in storing and accessing the information of the user using the application.


Thanks & Regards
Saurabh Mahajan

推荐答案

用于存储数据的方法创建类Global

并在其中声明静态变量

例如.

for storing data create a class Global

and declare static variables inside it

for ex.

public static string userid="user";



和btn_login



and and btn_login

Global.userid=txtuser.text;


会话不是桌面应用程序中的相关概念-基于Web的应用程序用于保留会话页面之间的信息,因为在页面加载完成后可以破坏应用程序.在桌面应用程序中,则不需要此操作,因为整个客户端"计算机均可用于该应用程序.

假设您已经有一个用户登录到PC,并且您可以很容易地获得他的详细信息,那么您想要的听起来更像是活动日志,除非您试图在用户顶部添加另一层用户登录.那?

如果您想要一个活动日志,那么就去寻找它-您会发现负载! http://www.google. co.uk/search?sourceid=chrome&ie=UTF-8&q=create+activity+log+c%23 [
Session is not a relevant concept in desktop applications - with web based apps it is used to preserve information between pages since the application can be destroyed when the page load has been completed. In desktop applications, then is no need of this, since the whole of the "client" machine is available to the application.

What you want sounds more like an activity log than anything else, given that you already have a user logged in to teh PC and you can get his details quite easily - unless you are trying to add another layer of user log in on the top of that?

If you want an activity log, then goolge for it - you will find loads! http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=create+activity+log+c%23[^]

Otherwise, you have to decide what you are trying to do, and describe it a bit more fully than you have! :laugh:
But be aware, if your app is not obviously security related, you will annoy the heck out of users by asking them to remember yet another set of user id and passwords...


这篇关于如何在c#桌面应用程序中创建会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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