title: C# 'Must declare the scalar variable "@ID_ZAPISA"' error
body: <p>I am having problem with the following code. Delete function does not work (throws scalar variable error). Update function does not work ... it does not throw any error, but it simply does not make changes to the database.</p>
  
  <p>If I make exact DetailsView, everything works OK. Where is the problem?</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ServisnaKnjiga.aspx.cs" Inherits="CernaticJurij_Default2" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server"&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"&gt;
      &lt;p&gt;
          Registrska številka:&amp;nbsp;
          &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
  &amp;nbsp;&amp;nbsp;
          &lt;asp:Button ID="Button1" runat="server" Text="Iskanje" /&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &lt;asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" 
              AutoGenerateRows="False" CellPadding="4" DataSourceID="SqlDataSource1" 
              ForeColor="#333333" GridLines="None" Height="50px" Width="915px"&gt;
              &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
              &lt;CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /&gt;
              &lt;EditRowStyle BackColor="#999999" /&gt;
              &lt;FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" /&gt;
              &lt;Fields&gt;
                  &lt;asp:BoundField DataField="REG_STEVILKA" HeaderText="REGISTRSKA ŠTEVILKA" 
                      SortExpression="REG_STEVILKA" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="VIN_STEVILKA" HeaderText="VIN ŠTEVILKA" 
                      SortExpression="VIN_STEVILKA" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="ZNAMKA" HeaderText="ZNAMKA" 
                      SortExpression="ZNAMKA" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="MODEL" HeaderText="MODEL" SortExpression="MODEL" 
                      InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="LETO_IZDELAVE" HeaderText="LETO IZDELAVE" 
                      SortExpression="LETO_IZDELAVE" InsertVisible="False" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="ID_ZAPISA" HeaderText="ID_ZAPISA" 
                      InsertVisible="False" ReadOnly="True" SortExpression="ID_ZAPISA" /&gt;
                  &lt;asp:BoundField DataField="DATUM" HeaderText="DATUM" 
                      SortExpression="DATUM" /&gt;
                  &lt;asp:BoundField DataField="KILOMETRINA" HeaderText="KILOMETRINA" 
                      SortExpression="KILOMETRINA" /&gt;
                  &lt;asp:BoundField DataField="OPIS" HeaderText="OPIS" SortExpression="OPIS" /&gt;
                  &lt;asp:BoundField DataField="ODG_OSEBA" HeaderText="ODGOVORNA OSEBA" 
                      SortExpression="ODG_OSEBA" /&gt;
                  &lt;asp:BoundField DataField="CENA" HeaderText="CENA" SortExpression="CENA" /&gt;
                  &lt;asp:BoundField DataField="REG_STEVILKA1" HeaderText="REG_STEVILKA1" 
                      SortExpression="REG_STEVILKA1" Visible="False" /&gt;
                  &lt;asp:BoundField DataField="ID_STRANKE" HeaderText="ID_STRANKE" 
                      SortExpression="ID_STRANKE" Visible="False" /&gt;
                  &lt;asp:BoundField DataField="PROSTORNINA_MOTORJA" HeaderText="PROSTORNINA_MOTORJA" 
                      SortExpression="PROSTORNINA_MOTORJA" Visible="False" /&gt;
                  &lt;asp:BoundField DataField="MOC_MOTORJA" 
                      HeaderText="MOC_MOTORJA" SortExpression="MOC_MOTORJA" 
                      Visible="False" /&gt;
                  &lt;asp:BoundField DataField="TIP_MOTORJA" HeaderText="TIP_MOTORJA" 
                      SortExpression="TIP_MOTORJA" Visible="False" /&gt;
                  &lt;asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                      ShowInsertButton="True" /&gt;
              &lt;/Fields&gt;
              &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
              &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /&gt;
              &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
              &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" /&gt;
          &lt;/asp:DetailsView&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
              ConnectionString="&lt;%$ ConnectionStrings:Stranke %&gt;" 
              DeleteCommand="DELETE FROM [SERVISNI_ZAPIS] WHERE [ID_ZAPISA] = @ID_ZAPISA"
  
              InsertCommand="INSERT INTO [SERVISNI_ZAPIS] ([REG_STEVILKA], [DATUM], [KILOMETRINA], [OPIS], [ODG_OSEBA], [CENA]) VALUES (@REG_STEVILKA, @DATUM, @KILOMETRINA, @OPIS, @ODG_OSEBA, @CENA)" SelectCommand="SELECT *
  FROM SERVISNI_ZAPIS
  FULL JOIN VOZILO
  ON (SERVISNI_ZAPIS.REG_STEVILKA=VOZILO.REG_STEVILKA)
  WHERE (SERVISNI_ZAPIS.REG_STEVILKA = @REG_STEVILKA)" 
  
              UpdateCommand="UPDATE [SERVISNI_ZAPIS] SET [REG_STEVILKA] = @REG_STEVILKA, [DATUM] = @DATUM, [KILOMETRINA] = @KILOMETRINA, [OPIS] = @OPIS, [ODG_OSEBA] = @ODG_OSEBA, [CENA] = @CENA WHERE [ID_ZAPISA] = @ID_ZAPISA"&gt;
              &lt;DeleteParameters&gt;
                  &lt;asp:Parameter Name="ID_ZAPISA" Type="Int32" /&gt;
              &lt;/DeleteParameters&gt;
              &lt;InsertParameters&gt;
                  &lt;asp:ControlParameter ControlID="TextBox1" Name="REG_STEVILKA" 
                      PropertyName="Text" /&gt;
                  &lt;asp:Parameter DbType="Date" Name="DATUM" /&gt;
                  &lt;asp:Parameter Name="KILOMETRINA" Type="String" /&gt;
                  &lt;asp:Parameter Name="OPIS" Type="String" /&gt;
                  &lt;asp:Parameter Name="ODG_OSEBA" Type="String" /&gt;
                  &lt;asp:Parameter Name="CENA" Type="String" /&gt;
              &lt;/InsertParameters&gt;
              &lt;SelectParameters&gt;
                  &lt;asp:ControlParameter ControlID="TextBox1" Name="REG_STEVILKA" 
                      PropertyName="Text" /&gt;
              &lt;/SelectParameters&gt;
              &lt;UpdateParameters&gt;
                  &lt;asp:Parameter Name="REG_STEVILKA" Type="String" /&gt;
                  &lt;asp:Parameter DbType="Date" Name="DATUM" /&gt;
                  &lt;asp:Parameter Name="KILOMETRINA" Type="String" /&gt;
                  &lt;asp:Parameter Name="OPIS" Type="String" /&gt;
                  &lt;asp:Parameter Name="ODG_OSEBA" Type="String" /&gt;
                  &lt;asp:Parameter Name="CENA" Type="String" /&gt;
                  &lt;asp:Parameter Name="ID_ZAPISA" Type="Int32" /&gt;
              &lt;/UpdateParameters&gt;
          &lt;/asp:SqlDataSource&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &amp;nbsp;&lt;/p&gt;
      &lt;p&gt;
          &amp;nbsp;&lt;/p&gt;
  &lt;/asp:Content&gt;
  </code></pre>