title: Incorrect syntax near 'int' when using updatecommand on a gridview
body: <p>I have a problem that when ever I try to update a record in the database using gridview update event handler and an updatecommand in sqldatascource
  I get the following exception
  Incorrect syntax near 'int'.
  the weird thing is when I reload the page I find that the record was updated successfully but yet I need this exception message not to appear what should I do</p>
  
  <p>update event handler</p>
  
  <pre><code>   protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
      {
  
              GridViewRow row = GridView1.Rows[e.RowIndex];
              int BusId = Convert.ToInt32(((DataKey)GridView1.DataKeys[e.RowIndex]).Value);
              TextBox Capacity =(TextBox) row.Cells[1].Controls[0];
              TextBox DriverName =(TextBox) row.Cells[3].Controls[0];
              TextBox Phone =(TextBox) row.Cells[4].Controls[0];
              SqlDataSource1.UpdateParameters.Add("capaity", Capacity.Text);
              SqlDataSource1.UpdateParameters.Add("id", BusId.ToString());
              SqlDataSource1.UpdateParameters.Add("driver", DriverName.Text);
              SqlDataSource1.UpdateParameters.Add("phone", Phone.Text);
              SqlDataSource1.Update();
      }
  </code></pre>
  
  <p>gridview asp.net code</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="Bus Number" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="326px" Width="1017px" OnRowUpdating="GridView1_RowUpdating"&gt;
              &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
              &lt;Columns&gt;
                  &lt;asp:BoundField DataField="Bus Number" HeaderText="Bus Number" ReadOnly="True" SortExpression="Bus Number" /&gt;
                  &lt;asp:BoundField DataField="Capacity" HeaderText="Capacity" SortExpression="Capacity" /&gt;
                  &lt;asp:BoundField DataField="NumberOfBooking" HeaderText="NumberOfBooking" SortExpression="NumberOfBooking" ReadOnly="True" /&gt;
                  &lt;asp:BoundField DataField="Driver" HeaderText="Driver" SortExpression="Driver" /&gt;
                  &lt;asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" ShowHeader="False" /&gt;
                  &lt;asp:BoundField DataField="Date Added" HeaderText="Date Added" SortExpression="Date Added" DataFormatString="{0:MM/dd/yyyy}" ReadOnly="True" /&gt;
                  &lt;asp:CommandField ShowEditButton="True" /&gt;
                  &lt;asp:CommandField ShowDeleteButton="True" /&gt;
              &lt;/Columns&gt;
              &lt;EditRowStyle BackColor="#999999" /&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;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
              &lt;SortedAscendingCellStyle BackColor="#E9E7E2" /&gt;
              &lt;SortedAscendingHeaderStyle BackColor="#506C8C" /&gt;
              &lt;SortedDescendingCellStyle BackColor="#FFFDF8" /&gt;
              &lt;SortedDescendingHeaderStyle BackColor="#6F8DAE" /&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>the updatecommand </p>
  
  <pre><code>UpdateCommand="UPDATE Buses SET Capacity = @capaity WHERE VechileId = @id ;UPDATE Vechile SET Driver = @driver, Phone = @phone  
   WHERE VechileId = @id"&gt;
  </code></pre>