Skip to content

Instantly share code, notes, and snippets.

@corynissen
Last active August 29, 2015 14:15
Show Gist options
  • Save corynissen/d52bdca7b7a8a1a8512a to your computer and use it in GitHub Desktop.
Save corynissen/d52bdca7b7a8a1a8512a to your computer and use it in GitHub Desktop.
SO question 28475137
library(RODBC)
shinyServer(function(input,output){
output$txt1<-renderTable({
input$b1
if(input$b1==0 )return()
isolate({
con<-odbcConnect("sample",uid="amma",pwd="amma")
sqlTables(con)
# sqlQuery(con,"insertintosampvalues('",input$text1,"',",input$text2,")");
sqlQuery(con,paste0("insertintosampvalues('",input$text1,"',",input$text2,")"));
sqlQuery(con,"select * from samp");
})
})
})
library(shiny)
shinyUI(
fluidPage(
mainPanel(
textInput("text1"," ",value = " "),
numericInput("text2"," ",value = " "),
actionButton("b1", label = "select"),
tableOutput("txt1")
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment