title: how to update multiple fields of a table using a sql statement in vb.net?
body: <p>When trying to update multiple fields using a form, I receive an error message "No value given for one or more required parameters." At the .ExecuteNonQuery() Could someone please clarify whether I should be using .AddwithValue for the fields I am updating; or for my "WHERE" field? (RunnerID) Thanks in advance</p>
  
  <p>(I have a public class that sets up the database connection and I have imported Oledb and am able to update a Boolean field to True in another one of my forms. )</p>
  
  <pre><code>Private Sub ChangeBtn_Click(sender As Object, e As EventArgs) Handles ChangeBtn.Click
      conn.Open()
      Dim sqlQuery As String = "UPDATE tblPersonal SET Phone = @Phonetxt, Email = @Emailtxt, Age = @Agetxt, Full_Name = @Nametxt, Login_Key = @Passwordtxt WHERE RunnerID = @RunnerIDtxt"
      Dim sqlCommand As New OleDbCommand
      With sqlCommand
          .CommandText = sqlQuery
          .Parameters.AddWithValue("@Phonetxt", Phonetxt.Text)
          .Parameters.AddWithValue("@Emailtxt", Emailtxt.Text)
          .Parameters.AddWithValue("@Agetxt", Agetxt.Text)
          .Parameters.AddWithValue("@Nametxt", Nametxt.Text)
          .Parameters.AddWithValue("@Passwordtxt", Passwordtxt.Text)
          .Connection = conn
          .ExecuteNonQuery()
  
      End With
      conn.Close()
  End Sub
  </code></pre>