Link to home
Start Free TrialLog in
Avatar of DotNetNooby
DotNetNooby

asked on

Edit gridview and set field value = to Session variable

How can I set the value of a USER_NAME field to the value of a session variable?  
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                SelectCommand="SELECT PERSONNEL_ID, CATEGORY, NAME, RECORD_STATUS  FROM table WHERE (RECORD_STATUS = 'Active')"               
                UpdateCommand="UPDATE table SET CATEGORY = :CATEGORY, NAME = :NAME, RECORD_STATUS = :RECORD_STATUS, USER_ID= :USER_ID (PERSONNEL_ID = :PERSONNEL_ID)">
                <UpdateParameters>
                    <asp:Parameter Name="CATEGORY" />
                    <asp:Parameter Name="NAME" />
                    <asp:Parameter Name="RECORD_STATUS" />
                    <asp:Parameter Name="PERSONNEL_ID" />
                    <asp:Parameter Name="USER_ID"  DefaultValue=Session(userName) />
                </UpdateParameters>
            </asp:SqlDataSource>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Steve Krile
Steve Krile
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial