C#: No value given for one or more required parameter with FormView
<p>I am using a FormView and when I want to update something I have edited, I always get this error:</p>

<blockquote>
  <p>No value given for one or more
  required parameters.</p>
</blockquote>

<p>I use a SQLDataSource in combination with a FormView.</p>

<p>This the code of my formview.</p>

<pre><code>&lt;asp:SqlDataSource ID="sqldsLokaalPrinters" runat="server" 
        ConnectionString="&lt;%$ ConnectionStrings:connRand2 %&gt;" 
        DeleteCommand="DELETE FROM [tblComputers] WHERE (([tblArtveldenr] = ?) OR ([tblArtveldenr] IS NULL AND ? IS NULL))" 
        InsertCommand="INSERT INTO [tblComputers] ([tblArtveldenr], [tblNaam], [tblCLokaal_id], [tblPositie], [tblSerienr], [tblTCPIP], [tblFabrikant], [tblModel], [tblProcessor], [tblSnelheid], [tblKleur], [tblGeheugen], [tblHarddisk], [tblZip], [tblCD], [tblDVD], [tblNetwerk], [tblFirewire], [tblAanschafdatum], [tblCLeverabcierNr], [tblScherm], [tblLaptop]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 
        ProviderName="&lt;%$ ConnectionStrings:connRand2.ProviderName %&gt;" 
        SelectCommand="SELECT * FROM [tblComputers] WHERE ([tblCLokaal_id] = ?)" 
        UpdateCommand="UPDATE [tblComputers] SET [tblNaam] = ?, [tblCLokaal_id] = ?, [tblPositie] = ?, [tblSerienr] = ?, [tblTCPIP] = ?, [tblFabrikant] = ?, [tblModel] = ?, [tblProcessor] = ?, [tblSnelheid] = ?, [tblKleur] = ?, [tblGeheugen] = ?, [tblHarddisk] = ?, [tblZip] = ?, [tblCD] = ?, [tblDVD] = ?, [tblNetwerk] = ?, [tblFirewire] = ?, [tblAanschafdatum] = ?, [tblCLeverabcierNr] = ?, [tblScherm] = ?, [tblLaptop] = ? WHERE (([tblArtveldenr] = ?) OR ([tblArtveldenr] IS NULL AND ? IS NULL))"&gt;
        &lt;SelectParameters&gt;
            &lt;asp:SessionParameter Name="tblCLokaal_id" SessionField="lokaalID" 
                Type="Int16" /&gt;
        &lt;/SelectParameters&gt;
        &lt;DeleteParameters&gt;
            &lt;asp:Parameter Name="tblArtveldenr" Type="String" /&gt;
        &lt;/DeleteParameters&gt;
        &lt;UpdateParameters&gt;
            &lt;asp:Parameter Name="tblNaam" Type="String" /&gt;
            &lt;asp:Parameter Name="tblCLokaal_id" Type="Int16" /&gt;
            &lt;asp:Parameter Name="tblPositie" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblSerienr" Type="String" /&gt;
            &lt;asp:Parameter Name="tblTCPIP" Type="String" /&gt;
            &lt;asp:Parameter Name="tblFabrikant" Type="String" /&gt;
            &lt;asp:Parameter Name="tblModel" Type="String" /&gt;
            &lt;asp:Parameter Name="tblProcessor" Type="String" /&gt;
            &lt;asp:Parameter Name="tblSnelheid" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblKleur" Type="String" /&gt;
            &lt;asp:Parameter Name="tblGeheugen" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblHarddisk" Type="Double" /&gt;
            &lt;asp:Parameter Name="tblZip" Type="String" /&gt;
            &lt;asp:Parameter Name="tblCD" Type="String" /&gt;
            &lt;asp:Parameter Name="tblDVD" Type="String" /&gt;
            &lt;asp:Parameter Name="tblNetwerk" Type="String" /&gt;
            &lt;asp:Parameter Name="tblFirewire" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblAanschafdatum" Type="DateTime" /&gt;
            &lt;asp:Parameter Name="tblCLeverabcierNr" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblScherm" Type="String" /&gt;
            &lt;asp:Parameter Name="tblLaptop" Type="Boolean" /&gt;
            &lt;asp:Parameter Name="tblArtveldenr" Type="String" /&gt;
        &lt;/UpdateParameters&gt;
        &lt;InsertParameters&gt;
            &lt;asp:Parameter Name="tblArtveldenr" Type="String" /&gt;
            &lt;asp:Parameter Name="tblNaam" Type="String" /&gt;
            &lt;asp:Parameter Name="tblCLokaal_id" Type="Int16" /&gt;
            &lt;asp:Parameter Name="tblPositie" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblSerienr" Type="String" /&gt;
            &lt;asp:Parameter Name="tblTCPIP" Type="String" /&gt;
            &lt;asp:Parameter Name="tblFabrikant" Type="String" /&gt;
            &lt;asp:Parameter Name="tblModel" Type="String" /&gt;
            &lt;asp:Parameter Name="tblProcessor" Type="String" /&gt;
            &lt;asp:Parameter Name="tblSnelheid" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblKleur" Type="String" /&gt;
            &lt;asp:Parameter Name="tblGeheugen" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblHarddisk" Type="Double" /&gt;
            &lt;asp:Parameter Name="tblZip" Type="String" /&gt;
            &lt;asp:Parameter Name="tblCD" Type="String" /&gt;
            &lt;asp:Parameter Name="tblDVD" Type="String" /&gt;
            &lt;asp:Parameter Name="tblNetwerk" Type="String" /&gt;
            &lt;asp:Parameter Name="tblFirewire" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblAanschafdatum" Type="DateTime" /&gt;
            &lt;asp:Parameter Name="tblCLeverabcierNr" Type="Int32" /&gt;
            &lt;asp:Parameter Name="tblScherm" Type="String" /&gt;
            &lt;asp:Parameter Name="tblLaptop" Type="Boolean" /&gt;
        &lt;/InsertParameters&gt;
    &lt;/asp:SqlDataSource&gt;
</code></pre>

<p>This is the code of my SQLDataSource</p>

<pre><code>&lt;asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
        DataKeyNames="tblArtveldenr" DataSourceID="sqldsLokaalPrinters"&gt;
        &lt;EditItemTemplate&gt;
            tblPositie:
            &lt;asp:TextBox ID="tblPositieTextBox" runat="server" 
                Text='&lt;%# Bind("tblPositie") %&gt;' /&gt;
            &lt;br /&gt;
            tblSerienr:
            &lt;asp:TextBox ID="tblSerienrTextBox" runat="server" 
                Text='&lt;%# Bind("tblSerienr") %&gt;' /&gt;
            &lt;br /&gt;
            tblFabrikant:
            &lt;asp:TextBox ID="tblFabrikantTextBox" runat="server" 
                Text='&lt;%# Bind("tblFabrikant") %&gt;' /&gt;
            &lt;br /&gt;
            tblModel:
            &lt;asp:TextBox ID="tblModelTextBox" runat="server" 
                Text='&lt;%# Bind("tblModel") %&gt;' /&gt;
            &lt;br /&gt;
            tblSnelheid:
            &lt;asp:TextBox ID="tblSnelheidTextBox" runat="server" 
                Text='&lt;%# Bind("tblSnelheid") %&gt;' /&gt;
            &lt;br /&gt;
            tblHarddisk:
            &lt;asp:TextBox ID="tblHarddiskTextBox" runat="server" 
                Text='&lt;%# Bind("tblHarddisk") %&gt;' /&gt;
            &lt;br /&gt;
            tblCD:
            &lt;asp:TextBox ID="tblCDTextBox" runat="server" Text='&lt;%# Bind("tblCD") %&gt;' /&gt;
            &lt;br /&gt;
            tblDVD:
            &lt;asp:TextBox ID="tblDVDTextBox" runat="server" Text='&lt;%# Bind("tblDVD") %&gt;' /&gt;
            &lt;br /&gt;
            tblAanschafdatum:
            &lt;asp:TextBox ID="tblAanschafdatumTextBox" runat="server" 
                Text='&lt;%# Bind("tblAanschafdatum") %&gt;' /&gt;
            &lt;br /&gt;
            &lt;asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" /&gt;
            &amp;nbsp;&lt;asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" /&gt;
        &lt;/EditItemTemplate&gt;
        &lt;InsertItemTemplate&gt;
            tblPositie:
            &lt;asp:TextBox ID="tblPositieTextBox" runat="server" 
                Text='&lt;%# Bind("tblPositie") %&gt;' /&gt;
            &lt;br /&gt;
            tblSerienr:
            &lt;asp:TextBox ID="tblSerienrTextBox" runat="server" 
                Text='&lt;%# Bind("tblSerienr") %&gt;' /&gt;
            &lt;br /&gt;
            tblFabrikant:
            &lt;asp:TextBox ID="tblFabrikantTextBox" runat="server" 
                Text='&lt;%# Bind("tblFabrikant") %&gt;' /&gt;
            &lt;br /&gt;
            tblModel:
            &lt;asp:TextBox ID="tblModelTextBox" runat="server" 
                Text='&lt;%# Bind("tblModel") %&gt;' /&gt;
            &lt;br /&gt;
            tblSnelheid:
            &lt;asp:TextBox ID="tblSnelheidTextBox" runat="server" 
                Text='&lt;%# Bind("tblSnelheid") %&gt;' /&gt;
            &lt;br /&gt;
            tblHarddisk:
            &lt;asp:TextBox ID="tblHarddiskTextBox" runat="server" 
                Text='&lt;%# Bind("tblHarddisk") %&gt;' /&gt;
            &lt;br /&gt;
            tblCD:
            &lt;asp:TextBox ID="tblCDTextBox" runat="server" Text='&lt;%# Bind("tblCD") %&gt;' /&gt;
            &lt;br /&gt;
            tblDVD:
            &lt;asp:TextBox ID="tblDVDTextBox" runat="server" Text='&lt;%# Bind("tblDVD") %&gt;' /&gt;
            &lt;br /&gt;
            tblAanschafdatum:
            &lt;asp:TextBox ID="tblAanschafdatumTextBox" runat="server" 
                Text='&lt;%# Bind("tblAanschafdatum") %&gt;' /&gt;
            &lt;br /&gt;
            &lt;asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" /&gt;
&amp;nbsp;&lt;asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" 
                CommandName="Cancel" Text="Cancel" /&gt;
        &lt;/InsertItemTemplate&gt;
        &lt;ItemTemplate&gt;
            tblPositie:
            &lt;asp:Label ID="tblPositieLabel" runat="server" 
                Text='&lt;%# Bind("tblPositie") %&gt;' /&gt;
            &lt;br /&gt;
            tblSerienr:
            &lt;asp:Label ID="tblSerienrLabel" runat="server" 
                Text='&lt;%# Bind("tblSerienr") %&gt;' /&gt;
            &lt;br /&gt;
            tblFabrikant:
            &lt;asp:Label ID="tblFabrikantLabel" runat="server" 
                Text='&lt;%# Bind("tblFabrikant") %&gt;' /&gt;
            &lt;br /&gt;
            tblModel:
            &lt;asp:Label ID="tblModelLabel" runat="server" Text='&lt;%# Bind("tblModel") %&gt;' /&gt;
            &lt;br /&gt;
            tblSnelheid:
            &lt;asp:Label ID="tblSnelheidLabel" runat="server" 
                Text='&lt;%# Bind("tblSnelheid") %&gt;' /&gt;
            &lt;br /&gt;
            tblHarddisk:
            &lt;asp:Label ID="tblHarddiskLabel" runat="server" 
                Text='&lt;%# Bind("tblHarddisk") %&gt;' /&gt;
            &lt;br /&gt;
            tblCD:
            &lt;asp:Label ID="tblCDLabel" runat="server" Text='&lt;%# Bind("tblCD") %&gt;' /&gt;
            &lt;br /&gt;
            tblDVD:
            &lt;asp:Label ID="tblDVDLabel" runat="server" Text='&lt;%# Bind("tblDVD") %&gt;' /&gt;
            &lt;br /&gt;
            tblAanschafdatum:
            &lt;asp:Label ID="tblAanschafdatumLabel" runat="server" 
                Text='&lt;%# Bind("tblAanschafdatum") %&gt;' /&gt;
            &lt;br /&gt;
            &lt;br /&gt;
            &lt;asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" /&gt;
            &amp;nbsp;&lt;asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" /&gt;
            &amp;nbsp;&lt;asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" /&gt;
        &lt;/ItemTemplate&gt;
    &lt;/asp:FormView&gt;
</code></pre>

<p>This is the code of my FormView</p>

<p>The questionmark in this part of the SQLDataSource is Session["id"]. I assign the value of Session["id"] in the previous page.</p>

<pre><code>SelectCommand="SELECT * FROM [tblComputers] WHERE ([tblCLokaal_id] = ?)" 
</code></pre>

<p>I have no idea how to solve this error</p>

<p>Thanks a lot Vincent</p>
