title: C# SQLite Update error (SQL Logic error or missing database near "(": syntax error.”)
body: <p>I have a WPF application with various textboxes and a dropdown box. I am trying to update my SQLite db, with the details that are entered into them. I have re-worked the method before I used to insert the data into the SQLite db in the first place. The issue is when I execute the code I get an error “SQL Logic error or missing database near "(": syntax error.”</p>
  
  <pre><code>private void ButtonEditExmUpdate_OnClick(object sender, RoutedEventArgs e)
  {
  
      var ModifiedDateTime = DateTime.Now;
      {
          var ConnString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
  
          using (var DbConnection = new SQLiteConnection(ConnString))
          {
              try
              {var InsertIntoTable = (@"Update [Exm]
                  Set(ExmID = @ExmID, ExmEnvironmentType = @ExmEnvironmentType, ExmURL = @ExmURL, ExmServer = @ExmServer, ExmModifiedDate = @ExmModifiedDate, ExmDeleted = @ExmDeleted)
                  WHERE(Exm.ExmDeleted = 0) AND (Exm.ExmID = '" + ExmID.Text + "')");
                  var insertIntoUsernamePasswordString = (@"Update [ExmUsernamePassword]
                  Set (ExmUsername = @ExmUsername, ExmPassword = @ExmPassword,  ExmServer = @ExmServer, ExmModifiedDate = @ExmModifiedDate)
                  WHERE(ExmUsernamePassword.Deleted = 0) AND (ExmUsernamePassword.ExmUsernamePasswordsID = '" + ExmUsernamePasswordsID.Text + "')");
                  var insertIntoExmTable = new SQLiteCommand(insertIntoExmTableString);
                  var insertIntoExmUsernamePasswordTable = new SQLiteCommand(insertIntoUsernamePasswordString);
  
                  insertIntoExmTable.Connection = DbConnection;
                  insertIntoExmUsernamePasswordTable.Connection = DbConnection;
                  DbConnection.Open();
  
                  insertIntoExmTable.Parameters.AddWithValue("@ExmEnvironmentType", ComboBoxExmEnvironmentType.Text);
                  insertIntoExmTable.Parameters.AddWithValue("@ExmURL", TextBoxExmUrl.Text);
                  insertIntoExmTable.Parameters.AddWithValue("@ExmServer", TextBoxExmServerName.Text);
                  insertIntoExmTable.Parameters.AddWithValue("@ExmModifiedDate", ModifiedDateTime);
  
                  insertIntoExmUsernamePasswordTable.Parameters.AddWithValue("@ExmUsername", TextBoxExmUsername.Text);
                  insertIntoExmUsernamePasswordTable.Parameters.AddWithValue("@ExmPassword", TextBoxExmPassword.Text);
                  insertIntoExmUsernamePasswordTable.Parameters.AddWithValue("@ExmServer", TextBoxExmServerName.Text);
                  insertIntoExmUsernamePasswordTable.Parameters.AddWithValue("@ExmModifiedDate", ModifiedDateTime);
  
                  try
                  {
                      insertIntoExmTable.ExecuteNonQuery();
                      DbConnection.Close();
                      DbConnection.Open();
                      insertIntoExmUsernamePasswordTable.ExecuteNonQuery();
                      DbConnection.Close();
                      MessageBox.Show("Successfully updated");
                  }
                  catch (Exception ex)
                  {
                      throw new Exception(ex.Message);
                  }
              }
          }
      }
  }
  }
  </code></pre>
  
  <p>Error:
  SQL Logic error or missing database near "(": syntax error.</p>