title: SQL Server Update error
body: <p>I have an <code>Update</code> query that was working; however, I was not saving the new record first, which was causing issues with primary key constraints between users, when things got busy, for this fairly small application. Now, when the record has been saved with the primary key in the record, the user then enters data into the form, and needs to update the record using this action. The query generates the following error: </p>
  
  <blockquote>
    <p>Failed to convert parameter value from string to a decimal.</p>
  </blockquote>
  
  <p>This is odd because I am not trying to convert it to a decimal. I have found that the error resides at the end of my update query with the parameter <code>@MyRFA</code>. Not sure why, that is the primary key that has been inserted, and is also a <code>Varchar(15)</code>. <code>@MyRFA</code> is a 6-digit number like '112408', and has not had a problem until I decided to try and change things up a bit (I'm doing this in Dev).</p>
  
  <p>Here is my code. I tried to put line breaks in the code for viewing the long SQL line but they would not work, sorry!</p>
  
  <pre><code>Open_DB_Con()
  
  Dim cmd As New SqlCommand("Update RFA Set [ProjectNo] = @ProjectNo, [ContractNo] = @ContractNo, [EasementNo] = @EasementNo, [SSIDNo] = @SSIDNo, [OrdinanceNo] = @OrdinanceNo, [BA_CTNo] = @BA_CTNo, [FundNo] = @FundNo, [ResolutionNo] = @ResolutionNo, [DeedNo] = @DeedNo, [VendorName] = @VendorName, [Amount] = @Amount, [ProjectDescription] = @ProjectDescription, [Meeting] = @Meeting, [FileName] = @FileName, [Memo] = @Memo, [MayorsApproval] = @MayorsApproval, [RFA_Type] = @MyArea where RFA_Type = @MyArea and TrackNo = @MyRFA", Con)
  
  cmd.Parameters.Add("@ProjectNo", SqlDbType.VarChar, 100).Value = Trim(ProjNo.Text)
  cmd.Parameters.Add("@ContractNo", SqlDbType.VarChar, 50).Value = Trim(ContNo.Text)
  cmd.Parameters.Add("@EasementNo", SqlDbType.VarChar, 50).Value = Trim(EaseNo.Text)
  cmd.Parameters.Add("@SSIDNo", SqlDbType.VarChar, 50).Value = Trim(ssNo.Text)
  cmd.Parameters.Add("@OrdinanceNo", SqlDbType.VarChar, 50).Value = Trim(OrdNo.Text)
  cmd.Parameters.Add("@BA_CTNo", SqlDbType.VarChar, 50).Value = Trim(baNo.Text)
  cmd.Parameters.Add("@FundNo", SqlDbType.VarChar, 50).Value = Trim(FunNo.Text)
  cmd.Parameters.Add("@ResolutionNo", SqlDbType.VarChar, 50).Value = Trim(ResNo.Text)
  cmd.Parameters.Add("@DeedNo", SqlDbType.VarChar, 50).Value = Trim(DeeNo.Text)
  cmd.Parameters.Add("@VendorName", SqlDbType.VarChar, 250).Value = Trim(VenNam.Text)
  cmd.Parameters.Add("@Amount", SqlDbType.Decimal, 19, 2).Value = Trim(txtAmt.Text)
  cmd.Parameters.Add("@ProjectDescription", SqlDbType.VarChar, 250).Value = Trim(ProDesc.Text)
  cmd.Parameters.Add("@Meeting", SqlDbType.VarChar, 15).Value = Trim(Meet.Text)
  cmd.Parameters.Add("@FileName", SqlDbType.VarChar, 100).Value = Trim(FilNam.Text)
  cmd.Parameters.Add("@Memo", SqlDbType.VarChar, 3500).Value = Trim(txtMemo.Text)
  cmd.Parameters.Add("@MayorsApproval", SqlDbType.VarChar, 15).Value = Trim(MayApp.Text)
  cmd.Parameters.Add("@MyArea", SqlDbType.VarChar, 15).Value = Trim(SelArea)
  cmd.Parameters.Add("@MyRFA", SqlDbType.VarChar, 5).Value = Trim(RFA)
  
  cmd.ExecuteNonQuery()
  </code></pre>
  
  <p>Does anyone have any suggestions?</p>