title: Cannot Update SQL data in Shiny + RMySQL by actionButton()
body: <p>I am trying to construct a form in Shiny, to let my coworker maintains data in MySQL.</p>
  
  <p>My RMySQL works, I can use <code>dbSendQuery(MySQLCon, Query)</code>,
    but if I want to use <code>actionButton()</code> to <code>UPDATE TableName SET Colname = 'Value' WHERE ID = 'ID'</code> information to database,
    It can't work, and it also shows no warning.</p>
  
  <p>And if I directly execute for example <code>UpdateMySQL(DataTableName, "DayBir", "1989/06/04", "A001")</code>, mysql will UPDATE, but it will have a <code>warning : "Closing open result sets"</code></p>
  
  <p>Would you please help me to confirm is there any reactive expression is illegal ?</p>
  
  <p>Code <strong>ui.R</strong>:</p>
  
  <pre><code># define UI
  shinyUI(bootstrapPage(
    # I add some js and css here for login mechanism by https://gist.github.com/withr/9001831
    # so if I want to use observe()
    # I should put observe() in the observe() which for login
    # and it will report error
  
    title = "Shiny Demo",
  
    # mainPanel
    uiOutput("MainUI")
  ))
  </code></pre>
  
  <p>Code in <strong>server.R</strong>:</p>
  
  <pre><code># Load Data loading R
  library(RMySQL)
  
  MySQLCon = dbConnect(MySQL(),
                   host = "localhost",
                   db = "DB",
                   user = "Usr",
                   password = "PW")
  DataTableName = "Data"
  
  DataInput = dbReadTable(MySQLCon, DataTableName)
  
  # turn off connection
  Allcons = dbListConnections(MySQL())
  for (MySQLCon in Allcons) {
    dbDisconnect(MySQLCon)
  }
  
  UpdateMySQL = function(DataTableName, ColName, UpdateValue, UpdateIDSubj) {
    library(RMySQL)
    MySQLCon = dbConnect(MySQL(),
                     host = "localhost",
                     db = "DB",
                     user = "Usr",
                     password = "PW")
    Query = paste('UPDATE', DataTableName, ' ', # name of table in db
                    'SET', ColName, '="', UpdateValue, '" ', 
                    'WHERE IDSubj ="', UpdateIDSubj, '";', sep = "")
    dbSendQuery(MySQLCon, Query)
  
    # turn off connection
    Allcons = dbListConnections(MySQL())
    for (MySQLCon in Allcons) {
      dbDisconnect(MySQLCon)
    }
  }
  
  shinyServer(function(input, output) {
    # Authenticate
    observe({
      if (USER$Logged == TRUE) {
        # KeyIn UI
        source("./KeyIn/KeyIn.R",  local = TRUE, encodin = "utf-8")
  
        # main
        output$MainUI = renderUI({
          mainPanel(
            tabsetPanel(id = 'TabSet',
              tabPanel(title = "Key In Data",
                numericInput("KeyInChoice", "Choice Row You Want", value = 1,
                  min = 1, max = dim(DataInput)[1], step = 1),
                uiOutput("KeyIn")),,
              tabPanel(title = "Raw Data",
                dataTableOutput("TableInput"))
            )
          )
        })
  
        output$TableInput = renderDataTable({
            DataInput
          }, option = list(orderClasses = TRUE))
  
      } # else show nothing
    })
  })
  </code></pre>
  
  <p>Code in <strong>KeyIn.R</strong></p>
  
  <pre><code>output$ApplyKeyIn = renderUI({
    fluidPage(
      fluidRow(
        column(width = 3,
          # Subj ID
          textInput("IDSubj", "Subj ID",
                  value = reactive({
                         if (is.null(input$KeyInChoice)) {
                         return("NULL")
                          } else {
                        return(isolate({ DataInput$IDSubj[input$KeyInChoice] })) }
                       })())
        ),
        column(width = 3,
          # Birthday
          dateInput("DayBir", "Birthday",
                      value = reactive({
                                 if (is.null(input$KeyInChoice)) {
                         return("NULL")
                          } else {
                        return(isolate({ DataInput$DayBir[input$KeyInChoice] })) }
                           })(),
                      max = DateNow, format = "yyyy/mm/dd", language = "zh-TW")
        )
      ),
      fluidRow(
        column(width = 12,
          # Send
          actionButton("KeyInSend", "Send")
        )
      )
    )
  })
  
  # listening to edit data
  KeyInUpdate = reactive({
    if (input$KeyInSend == 0) {
      return()
    }
  
    input$KeyInSend
  
    isolate({
      IDSubj = input$IDSubj
      DayBir = input$DayBir
      UpdateMySQL(DataTableName, "DayBir", DayBir, IDSubj)
    })
  })
  </code></pre>