为什么以下代码不会返回任何数据?数据库中有Context.User.Identity.GetUserId()
ASPX标记:
<asp:SqlDataSource ID="owner_information" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SELECT * FROM [Viewtest] WHERE [IDuser] = @IDowner">
<SelectParameters>
<asp:Parameter Name="IDowner" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
代码隐藏:
protected void Page_PreRender(object sender, EventArgs e)
{
owner_information.SelectParameters["IDowner"].DefaultValue = Context.User.Identity.GetUserId();
}