gpt4 book ai didi

c# - 在查询中使用当前登录的用户

转载 作者:太空宇宙 更新时间:2023-11-03 11:54:35 25 4
gpt4 key购买 nike

我将 VisualWebDeveloperExpress2008 与 Access 作为成员提供程序。

在某些情况下,我希望用户编辑自己的数据。这将涉及一个查询,其中 UserId 应等于正在使用该网站的用户的 UserID。

我希望使用 WHERE UserId = ?,但我还没有找到指向“?”的位置。

IDE 给出了几个选择,但我不确定该选择哪个。这虽然看起来很有希望但行不通:

<SelectParameters>
<asp:ProfileParameter Name="UserID" PropertyName="UserId" Type="Int32" />
</SelectParameters>

选择参数最好使用什么?

最佳答案

尝试使用

<SelectParameters>
<asp:SessionParameter Name="UserName" SessionField="CurrentUser" Type="String" />
</SelectParameters>

在 Page_Load 上插入以下...

Session["CurrentUser"] = User.Identity.Name;

这应该适合你。

关于c# - 在查询中使用当前登录的用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/981410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com