title: Update Statement in SQL Server
body: <p>I am trying to update some records after a new record was inserted where it was not updating and I'm not getting any error.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    If txtSearch.Text &lt;&gt; txtUserID.Text Then
          Try
              Dim connectionString As String = "Data Source=.\SqlExpress;Initial Catalog=Subscription;Integrated Security=True"
              Using cn As New SqlConnection(connectionString)
                  cn.Open()
                  cmd.CommandText = "INSERT INTO Customers (UserID, RegisteredDate, ExpiryDate, FirstName, LastName, Address, State, City, Phone, Mobile, Email) VALUES(@UserID, @RegisteredDate, @ExpiryDate, @FirstName, @LastName, @Address, @State, @City, @Phone, @Mobile, @Email)"
  
                  Dim param1 As New SqlParameter()
                  param1.ParameterName = "@UserID"
                  param1.Value = txtUserID.Text.Trim()
                  cmd.Parameters.Add(param1)
  
                  Dim param2 As New SqlParameter()
                  param2.ParameterName = "@RegisteredDate"
                  param2.Value = RegisteredDate.Value
                  cmd.Parameters.Add(param2)
  
                  Dim param3 As New SqlParameter()
                  param3.ParameterName = "@ExpiryDate"
                  param3.Value = ExpiryDate.Value
                  cmd.Parameters.Add(param3)
  
                  Dim param4 As New SqlParameter()
                  param4.ParameterName = "@FirstName"
                  param4.Value = txtFirstName.Text.Trim()
                  cmd.Parameters.Add(param4)
  
                  Dim param5 As New SqlParameter()
                  param5.ParameterName = "@LastName"
                  param5.Value = txtLastName.Text.Trim()
                  cmd.Parameters.Add(param5)
  
  
                  Dim param6 As New SqlParameter()
                  param6.ParameterName = "@Address"
                  param6.Value = txtAddress.Text.Trim()
                  cmd.Parameters.Add(param6)
  
                  Dim param7 As New SqlParameter()
                  param7.ParameterName = "@State"
                  param7.Value = cboState.SelectedItem.ToString
                  cmd.Parameters.Add(param7)
  
                  Dim param8 As New SqlParameter()
                  param8.ParameterName = "@City"
                  param8.Value = cboCity.SelectedItem.ToString
                  cmd.Parameters.Add(param8)
  
                  Dim param9 As New SqlParameter()
                  param9.ParameterName = "@Phone"
                  param9.Value = txtPhone.Text.Trim()
                  cmd.Parameters.Add(param9)
  
                  Dim param10 As New SqlParameter()
                  param10.ParameterName = "@Mobile"
                  param10.Value = txtMobile.Text.Trim()
                  cmd.Parameters.Add(param10)
  
                  Dim param11 As New SqlParameter()
                  param11.ParameterName = "@Email"
                  param11.Value = txtEmail.Text.Trim()
                  cmd.Parameters.Add(param11)
  
                  cmd.Connection = cn
                  cmd.ExecuteNonQuery()
                  cn.Close()
              End Using
              Successlbl.Show()
              Successlbl.ForeColor = Color.DarkBlue
              Successlbl.Text = "Record Saved Successfully!."
  
          Catch
              Successlbl.Show()
              Successlbl.ForeColor = Color.Red
              Successlbl.Text = "Error in creating record!"
          End Try
      Else
          Try
              Dim connectionString As String = "Data Source=.\SqlExpress;Initial Catalog=Subscription;Integrated Security=True"
              Using cn As New SqlConnection(connectionString)
                  cn.Open()
                  cmd.CommandText = "UPDATE Customers SET (UserID, RegisteredDate, ExpiryDate, FirstName, LastName, Address, State, City, Phone, Mobile, Email) VALUES(@UserID, @RegisteredDate, @ExpiryDate, @FirstName, @LastName, @Address, @State, @City, @Phone, @Mobile, @Email) WHERE UserID=" &amp; txtUserID.Text &amp; ""
  
                  Dim param1 As New SqlParameter()
                  param1.ParameterName = "@UserID"
                  param1.Value = txtUserID.Text.Trim()
                  cmd.Parameters.Add(param1)
  
                  Dim param2 As New SqlParameter()
                  param2.ParameterName = "@RegisteredDate"
                  param2.Value = RegisteredDate.Value
                  cmd.Parameters.Add(param2)
  
                  Dim param3 As New SqlParameter()
                  param3.ParameterName = "@ExpiryDate"
                  param3.Value = ExpiryDate.Value
                  cmd.Parameters.Add(param3)
  
                  Dim param4 As New SqlParameter()
                  param4.ParameterName = "@FirstName"
                  param4.Value = txtFirstName.Text.Trim()
                  cmd.Parameters.Add(param4)
  
                  Dim param5 As New SqlParameter()
                  param5.ParameterName = "@LastName"
                  param5.Value = txtLastName.Text.Trim()
                  cmd.Parameters.Add(param5)
  
  
                  Dim param6 As New SqlParameter()
                  param6.ParameterName = "@Address"
                  param6.Value = txtAddress.Text.Trim()
                  cmd.Parameters.Add(param6)
  
                  Dim param7 As New SqlParameter()
                  param7.ParameterName = "@State"
                  param7.Value = cboState.SelectedItem.ToString
                  cmd.Parameters.Add(param7)
  
                  Dim param8 As New SqlParameter()
                  param8.ParameterName = "@City"
                  param8.Value = cboCity.SelectedItem.ToString
                  cmd.Parameters.Add(param8)
  
                  Dim param9 As New SqlParameter()
                  param9.ParameterName = "@Phone"
                  param9.Value = txtPhone.Text.Trim()
                  cmd.Parameters.Add(param9)
  
                  Dim param10 As New SqlParameter()
                  param10.ParameterName = "@Mobile"
                  param10.Value = txtMobile.Text.Trim()
                  cmd.Parameters.Add(param10)
  
                  Dim param11 As New SqlParameter()
                  param11.ParameterName = "@Email"
                  param11.Value = txtEmail.Text.Trim()
                  cmd.Parameters.Add(param11)
  
                  cmd.Connection = cn
                  cmd.ExecuteNonQuery()
              End Using
              Successlbl.Show()
              Successlbl.ForeColor = Color.DarkBlue
              Successlbl.Text = "Record updated Successfully!."
  
          Catch
              Successlbl.Show()
              Successlbl.ForeColor = Color.Red
              Successlbl.Text = "Error in updating record!"
          End Try
      End If
  </code></pre>
  
  <p>Can anyone say me where am I going wrong?</p>