title: sqldatasource update command not working and no SQL error
body: <p>I have a gridview with a data source. FOr some reason when I use the update button on the data source it is not updating. I am not getting a sql error and the query works fine when used directly.</p>
  
  <pre><code>&lt;asp:GridView ID="viewStoryTime" runat="server" AllowPaging="True" AutoGenerateColumns="False"
       DataSourceID="SqlDataSource10" DataKeyNames="NonScrumStoryId, PK_DailyTaskHours" BackColor="#DEBA84"
       BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
       Width="525px" OnRowEditing="viewStoryTime_OnRowEditing" OnRowCancelingEdit="viewStoryTime_OnRowCancelingEdit" OnRowUpdating="viewStoryTime_OnRowUpdating" OnRowUpdated="viewStoryTime_OnRowUpdated" &gt;
       &lt;Columns&gt;
            &lt;asp:BoundField DataField="Hours" HeaderText="Hours" SortExpression="Hours" /&gt;
            &lt;asp:BoundField DataField="Notes" HeaderText="Notes" SortExpression="Notes" /&gt;
            &lt;asp:BoundField DataField="ActivityDate" HeaderText="Date" SortExpression="ActivityDate" DataFormatString="{0:MM/dd/yyyy}" /&gt;
            &lt;asp:CommandField ShowEditButton="True" /&gt;
            &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  &lt;asp:SqlDataSource ID="SqlDataSource10" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ApplicationServices %&gt;"
       SelectCommand="SELECT [DailyTaskHours].[PK_DailyTaskHours], [DailyTaskHours].[NonScrumStoryId], [DailyTaskHours].[Hours], [DailyTaskHours].[Notes], [DailyTaskHours].[ActivityDate] FROM [NonScrumStory], [DailyTaskHours] WHERE [DailyTaskHours].[NonScrumStoryId] = @nonScrumStoryId AND [NonScrumStory].[PK_NonScrumStory] = @nonScrumStoryId"
       UpdateCommand="UPDATE [DailyTaskHours] SET [Hours] = @setEditHoursParam, [ActivityDate] = @setEditActivityDateParam, [Notes] = @setEditNotesParam WHERE [PK_DailyTaskHours] = @setDailyPKParam"&gt;
       &lt;SelectParameters&gt;
            &lt;asp:QueryStringParameter Name="nonScrumStoryId" Type="String" /&gt;
       &lt;/SelectParameters&gt;
       &lt;UpdateParameters&gt;
             &lt;asp:QueryStringParameter Name="setEditHoursParam" Type="String" /&gt;
             &lt;asp:QueryStringParameter Name="setEditActivityDateParam" Type="String" /&gt;
             &lt;asp:QueryStringParameter Name="setEditNotesParam" Type="String" /&gt;
             &lt;asp:QueryStringParameter Name="setDailyPKParam" Type="String" /&gt;
       &lt;/UpdateParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Here is the c# that applies the parameters:</p>
  
  <pre><code>protected void viewStoryTime_OnRowEditing(object sender, GridViewEditEventArgs e)
  {
      SqlDataSource10.UpdateParameters["setDailyPKParam"].DefaultValue = viewStoryTime.DataKeys[e.NewEditIndex].Values["PK_DailyTaskHours"].ToString();
      System.Diagnostics.Debug.WriteLine(viewStoryTime.DataKeys[e.NewEditIndex].Values["PK_DailyTaskHours"].ToString());
  
  }
  
  protected void viewStoryTime_OnRowUpdating(object sender, GridViewUpdateEventArgs e)
  {
      SqlDataSource10.UpdateParameters["setEditHoursParam"].DefaultValue = e.NewValues[0].ToString();
      SqlDataSource10.UpdateParameters["setEditActivityDateParam"].DefaultValue = e.NewValues[2].ToString();
      SqlDataSource10.UpdateParameters["setEditNotesParam"].DefaultValue = e.NewValues[1].ToString();
      System.Diagnostics.Debug.WriteLine(e.NewValues[0].ToString());
      System.Diagnostics.Debug.WriteLine(e.NewValues[2].ToString());
      System.Diagnostics.Debug.WriteLine(e.NewValues[1].ToString());
      SqlDataSource10.Update();
      SqlDataSource10.DataBind();
  }
  </code></pre>
  
  <p>Nopte that the Debug.WriteLine() is so I can see the output of what should be going to the parameters, here is an example output:</p>
  
  <p><img src="https://i.stack.imgur.com/8qPjr.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/TyFzB.png" alt="enter image description here"></p>
  
  <p>Debug output: 
  4911</p>
  
  <p><img src="https://i.stack.imgur.com/50V08.png" alt="enter image description here"></p>
  
  <p>Debug output:
  5.5
  7/9/2013 12:00:00 AM
  changed text </p>
  
  <p>And when I press Update:</p>
  
  <p><img src="https://i.stack.imgur.com/be9r7.png" alt="enter image description here"></p>