title: Import Data from SQL Server To shiny app
body: <p>i worked on data from SQL Server in R using <strong>RODBC</strong> and after getting my result i created <strong>ShinyApp</strong> to deploy my result But i want to get my data from my SQL query directly without exporting my result to Excel and then import it to shiny,How can i do that?</p>
  
  <pre><code>Test &lt;- odbcDriverConnect("driver={SQL Server};server=localhost;database=Fakahany;trusted_connection=true")
  Orders&lt;- sqlQuery(Test,"
  SELECT
    WHWorkOrderHeaderId
  , OtherLangDescription
  FROM   Warehouse.WHWorkOrderDetails 
     INNER JOIN Warehouse.WHWorkOrderHeader AS WHH
        ON Warehouse.WHWorkOrderDetails.WHWorkOrderHeaderId = WHH.ID 
    INNER JOIN Warehouse.StockItems 
       ON Warehouse.WHWorkOrderDetails.StockItemId = Warehouse.StockItems.Id 
  WHERE Type = 'IO'
  ORDER BY OtherLangDescription ASC")
  #Creating the correlations 
  Orders$OtherLangDescription &lt;- as.factor(Orders$OtherLangDescription)
  orderList &lt;- unique(Orders$OtherLangDescription) 
  ListId &lt;- lapply(orderList, function(x) subset(Orders, OtherLangDescription == x)$WHWorkOrderHeaderId) 
  Initial_Tab &lt;- lapply(ListId, function(x) subset(Orders, WHWorkOrderHeaderId %in% x)$OtherLangDescription) 
  Correlation_Tab &lt;- mapply(function(Product, ID) table(Product)/length(ID),
                          Initial_Tab, ListId) 
  colnames(Correlation_Tab) &lt;- orderList
  cor_per&lt;- round(Correlation_Tab*100,2)
  DF&lt;-data.frame(row=rownames(cor_per)[row(cor_per)], col=colnames(cor_per)[col(cor_per)], corr=c(cor_per))
  </code></pre>
  
  <p>and this is my app code:</p>
  
  <pre><code>#loading Packages 
  library(RODBC)
  library(shiny)
  library(rsconnect)
  ui &lt;- fluidPage(
    titlePanel("Item Correlation"),
    sidebarPanel(
      selectInput("Item2","Select Item",choices= DF$FirstItem),
      h6("Powerd By:"),
      img(src='edrak.png',height='50px',width='110px')
     # ,selectInput("Item","SelectItem",choices= DF$col)
    ),
    mainPanel(
      tableOutput("Itemcorr")
    )
  )
  server &lt;- function(input,output){
    output$Itemcorr &lt;- renderTable({
      subset(DF, DF$FirstItem == input$Item2)
    })
  }
  
  shinyApp(ui, server)
  </code></pre>