title: How to use insert parameter with textbox text in listview
body: <p>I am trying to use my <code>SqlDataSource</code> to enter items into the database with values from a TextBox, however nothing is inserting.</p>
  
  <p>Here is my <code>SqlDataSource</code>:</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SectionDataSource" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ORHP_Dev03182014ConnectionString %&gt;" SelectCommand="SELECT DISTINCT SectionItem FROM Core.SectionItem_Lkup"&gt;               
  &lt;/asp:SqlDataSource&gt;
  
  &lt;asp:SqlDataSource ID="SectionIDDataSource" runat="server " ConnectionString="&lt;%$ ConnectionStrings:ORHP_Dev03182014ConnectionString %&gt;" InsertCommand="INSERT INTO Core.SectionItem_Lkup(SectionItemID, SectionItem, SectionItemLabel) VALUES (@SectionID, @SectionItem, @SectionItemLabel)" SelectCommand="  SELECT MAX(SectionItemID) + 1 AS SectionItemID FROM [ORHP_Dev03182014].[Core].[SectionItem_Lkup]" OnInserting="Section_OnInserted"&gt;
      &lt;InsertParameters&gt;
          &lt;asp:Parameter Name="SectionID" /&gt;
          &lt;asp:Parameter Name="SectionItem" /&gt;
          &lt;asp:Parameter Name="SectionItemLabel" /&gt;
      &lt;/InsertParameters&gt;
  &lt;/asp:SqlDataSource&gt;
  </code></pre>
  
  <p>Here are the Textboxes in the listview:</p>
  
  <pre><code>&lt;InsertItemTemplate&gt;
      &lt;tr style=""&gt;
          &lt;td&gt;
              &lt;asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" On /&gt;
              &lt;asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" /&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;div style="font-size: .8em;"&gt;
              &lt;asp:FormView ID="SectionIDFormView" runat="server" DataKeyNames="SectionItemID" DataSourceID="SectionIDDataSource"&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:Label ID="SectionIDLabel" runat="server" Text="SectionID" Font-Bold="true" Font-Size="1.2em" /&gt;
                  &lt;asp:TextBox ID="SectionIDTextBox" runat="server" Text='&lt;%# Eval("SectionItemID") %&gt;' Width="50px" /&gt;
                  &lt;asp:Label ID="SectionItemLabel" runat="server" Text="SectionItem" Font-Bold="true" Font-Size="1.2em" /&gt;
                  &lt;asp:TextBox ID="SectionItemTextBox" runat="server" Text="" /&gt;
                  &lt;asp:Label ID="SectionItemSubLabel" runat="server" Text="SectionItem Label" Font-Bold="true" Font-Size="1.2em" /&gt;
                  &lt;asp:TextBox ID="SectionItemLabelTextBox" runat="server" Text="" /&gt;
              &lt;/ItemTemplate&gt;
              &lt;/asp:FormView&gt;
          &lt;/div&gt;
        &lt;/td&gt;
     &lt;/tr&gt;
  &lt;/InsertItemTemplate&gt;
  </code></pre>
  
  <p>Here is my code behind:</p>
  
  <pre><code>using (SqlConnection connection = new SqlConnection("Data Source=RCK-HRSA-DB01;Initial Catalog=ORHP_Dev03182014;User ID=userid;Password=password"))
  {
      try
      {
          SqlCommand cmd1 = new SqlCommand("INSERT INTO Core.SectionItem_Lkup(SectionItemID, SectionItem, SectionItemLabel) VALUES (" + SectionIDTextBox.Text + ", " + SectionItemTextBox.Text + ", " + SectionItemLabelTextBox.Text + ")");
          connection.Open();
          cmd1.Connection = connection;
          cmd1.CommandType = CommandType.Text;
          cmd1.ExecuteNonQuery();
      }
      catch (Exception ex)
      {
      }
  }
  </code></pre>
  
  <p>Am I missing something?</p>