Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Using a Session variable in an UpdateCommand

Using a Session variable in an UpdateCommand

Scheduled Pinned Locked Moved ASP.NET
helpsysadminjsontutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JohnQuar1
    wrote on last edited by
    #1

    Hello, I am trying to use a Session Variable in an update command and the error that I continue to get is: Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Server tags cannot contain <%...%>constructs. It also says that the Datasource is not well formed when I try to enter it in. Could someone help me figure out how to use this? The session variable I am trying to bring over is a global temp table name. Below is the code.

    <asp:SqlDataSource ID="FAR15DataSource" runat="server"
    ConnectionString="<%$ ConnectionStrings:Cost_ModelConnectionString %>"
    SelectCommand="SELECT Service_Tower_Code, WBS_Code, Ownertype, Compensation_Code, Compensation_Rate, Far_East_FTE, Hawaii_FTE,Mid_Atlantic_FTE, NCR_FTE, North_Midwest_FTE, Northeast_FTE, South_FTE, Southwest_FTE
    FROM fn_enterprise_positions(1)"
    UpdateCommand="UPDATE <%=Session["TableName"]%> SET Far_East_FTE = @Far_East_FTE, Hawaii_FTE = @Hawaii_FTE, Mid_Atlantic_FTE = @Mid_Atlantic_FTE, NCR_FTE = @NCR_FTE, North_Midwest_FTE = @North_Midwest_FTE, Northeast_FTE = @Northeast_FTE, South_FTE = @South_FTE, Southwest_FTE = @Southwest_FTE
    WHERE Service_Tower_Code = @Service_Tower_Code AND WBS_Code = @WBS_Code AND Compensation_Code = @Compensation_Code AND worker_code = @worker_code">
    <UpdateParameters>
    <asp:FormParameter Name="Service_Tower_Code" FormField="Service_Tower_Code" />
    <asp:FormParameter Name="WBS_Code" FormField="WBS_Code" />
    <asp:FormParameter Name="Compensation_Code" FormField="Compensation_Code" />
    <asp:FormParameter Name="worker_code" FormField="worker_code" />
    <asp:FormParameter Name="Compensation_Rate" FormField="Compensation_Rate" />
    <asp:FormParameter Name="Far_East_FTE" FormField="Far_East_FTE" />
    <asp:FormParameter Name="Hawaii_FTE" FormField="Hawaii_FTE" />
    <asp:FormParameter Name="Mid_Atlantic_FTE" FormField="Mid_Atlantic_FTE" />
    <asp:FormParameter Name="NCR_FTE" FormField="NCR_FTE" />
    <asp:FormParameter Name="North_Midwest_FTE" FormField="North_Midwest_FTE" />
    <asp:FormParameter Name="Northeast_FTE" FormField="N

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups