[英]User defined function to return the firstname and lastname or any other option?
In an SQL table, we have stored the username
only, and that info is shown in a gridview in a web application in .net (Sharepoint application page) 在一个SQL表中,我们仅存储了username
,并且该信息显示在.net(Sharepoint应用程序页面)中Web应用程序的gridview中
We use this column for security reasons, add the user to the specific sharepoint group, etc. However we want to show the firstname, lastname
. 出于安全原因,我们使用此列,将用户添加到特定的共享点组,等等。但是,我们要显示firstname, lastname
。
I thought 2 options: 我认为有两种选择:
Is there any other option? 还有其他选择吗? What do you think about my options? 您如何看待我的选择?
I think that this should not be done in the database, so I would not do 1. 我认为不应在数据库中执行此操作,因此我不会执行1。
Option 2. looks more promising. 选项2看起来更有希望。 However, I don't like how it's easy to miss this logic when someone is reading your code. 但是,我不喜欢有人阅读您的代码时容易错过此逻辑。
You could use something like model binding: http://www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data 您可以使用类似模型绑定的方法: http : //www.asp.net/web-forms/tutorials/data-access/model-binding/retrieving-data
You would replace studentsGrid_GetData
with the function to look up user data. 您可以使用该函数替换studentsGrid_GetData
来查找用户数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.