如何使用会话值从sql填充datalist详细信息 [英] how to use the session value to populate the datalist details from sql

查看:59
本文介绍了如何使用会话值从sql填充datalist详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与datalist的连接字符串

< asp:SqlDataSource ID =SqlDataSource1runat =serverConnectionString =<%$ ConnectionStrings:shareandcareConnectionString%>  SelectCommand =SELECT User_Id,Name,User_Name,Password,Email,Address,Account_Creation_Date,Status,Phone_Number,Bank_Account_No,Bank_Name,Bank_Branch FROM [User] WHERE(User_Name = @username)> 
< SelectParameters>
< asp:SessionParameter Name =usernameSessionField =username/>
< / SelectParameters>
< / asp:SqlDataSource>







我有我的会话。

 Session [userlogin]。ToString()。Split(',')[0] .Split(':')[1];  




提前感谢

解决方案

ConnectionStrings:shareandcareConnectionString%>SelectCommand =SELECT User_Id,Name,User_Name,Password,Email ,地址,Account_Creation_Date,Status,Phone_Number,Bank_Account_No,Bank_Name,Bank_Branch FROM [User] WHERE(User_Name = @username)>
< SelectParameters>
< asp:SessionParameter Name =username SessionField =username/>
< / SelectParameters>
< / asp:SqlDataSource>







i有我的会话。

 Session [userlogin]。ToString()。Split(',')[0] .Split( ':')[1]; 





页面加载时,会话用户名应检索a来自用户的数据。





提前感谢


//在这个例子中,员工成功登录后会话参数username设置为

//

 SessionParameter username = new SessionParameter(); 
empid.Name =username;
empid.Type = TypeCode.String;
empid.SessionField =username;



获取更多详细信息 msdn [ ^ ]


connection string to the datalist

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:shareandcareConnectionString %>" SelectCommand="SELECT User_Id, Name, User_Name, Password, Email, Address, Account_Creation_Date, Status, Phone_Number, Bank_Account_No, Bank_Name, Bank_Branch FROM [User] WHERE (User_Name = @username)">
    <SelectParameters>
        <asp:SessionParameter Name="username" SessionField="username" />
    </SelectParameters>
</asp:SqlDataSource>




i have my session.

Session["userlogin"].ToString().Split(',')[0].Split(':')[1];



when the page loads, the session username should retrieve the all the data from the user.


thanks in advance

解决方案

ConnectionStrings:shareandcareConnectionString %>" SelectCommand="SELECT User_Id, Name, User_Name, Password, Email, Address, Account_Creation_Date, Status, Phone_Number, Bank_Account_No, Bank_Name, Bank_Branch FROM [User] WHERE (User_Name = @username)"> <SelectParameters> <asp:SessionParameter Name="username" SessionField="username" /> </SelectParameters> </asp:SqlDataSource>




i have my session.

Session["userlogin"].ToString().Split(',')[0].Split(':')[1];



when the page loads, the session username should retrieve the all the data from the user.


thanks in advance


// In this example, the session parameter "username" is set
// after the employee successfully logs in.

SessionParameter username = new SessionParameter();
empid.Name = "username";
empid.Type = TypeCode.String;
empid.SessionField = "username";


Get moredetails msdn[^]


这篇关于如何使用会话值从sql填充datalist详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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