如何在C#中获取当前登录数据库用户的用户名 [英] How do I get the username of the currently logged in database user in C#
本文介绍了如何在C#中获取当前登录数据库用户的用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在用C#编写代码,我需要将当前用户的用户名存储在软件数据库表中,用户必须在登录前对其进行身份验证。
我已经尝试了
Environment.Username但这样做是为了当前登录的Windows操作系统用户。
我尝试过:
comboBox1.enabled = false;
comboBox1.Text =环境。 Username.ToString();
I'm writing code in C# and I need to have the username of the current user as stored in a software database table against which users must authenticate before logging in .
I've tried
Environment.Username but what this does is take the currently logged in Windows OS User.
What I have tried:
comboBox1.enabled= false;
comboBox1.Text = Environment. Username.ToString ();
推荐答案
尝试SELECT CURRENT_USER
。
当前的Windows用户可能与当前的SQLite用户不同。
TrySELECT CURRENT_USER
.
The current Windows user may be different from the current SQLite user.
这篇关于如何在C#中获取当前登录数据库用户的用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文