2017-06-19 75 views
0

我想連接到Access數據庫,在textInput中引入URL。RODBC with shiny error

服務器代碼如下:

function(input, output) { 

    dataframe <- eventReactive(input$do, { 

    db <- renderPrint({ input$text }) 

    con <- odbcConnectAccess(db()) 
    info <- sqlTables(channel = con, tableType = "TABLE")$TABLE_NAME 

    info 
    }) 

    output$table <- renderTable({ 
    dataframe() 

    }) 
} 

,我得到了如下錯誤:

Error: first argument is not an open RODBC channel 

我這樣做的地方。

感謝

+1

'input $ text'應該是Access數據庫的文件路徑嗎?如果是這樣,你應該使用'con < - odbcConnectAccess(input $ text)'。 'renderPrint'用於創建一個輸出插槽以顯示在用戶界面中。 – Benjamin

+1

你應該發佈可重現的例子!或者至少是什麼輸入$文本 –

回答

0

由於Benjammin注:

server.R

function(input, output) { 

     dataframe <- eventReactive(input$do, { 

     con <- odbcConnectAccess(input$text) 
     info <- sqlTables(channel = con, tableType = "TABLE")$TABLE_NAME 
     info 

    }) 

    output$table <- renderTable({ 
     dataframe() 

    }) 
    } 

輸入$文本是文件路徑訪問DDBB。

相關問題