Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted

1 solution

// 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[^]
 
Share this answer
 
Comments
Hamza Abdurrahman 5-Jul-14 3:35am    
i think your answer is correct.
but my sql command is in the html page(aspx).

how to connect the session name to the sql command.
so that this datasource gets the details using the session name

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900