Friday, February 05, 2016

cannot coerce type 'externalptr' to vector of type 'character'

Error:

Error in as.vector(x, "character") :
  cannot coerce type 'externalptr' to vector of type 'character'


Problem Code:

con <- dbConnect(RMySQL::MySQL(), dbname = "test")

sql <-
    paste0(
      "INSERT INTO `devharsh` (`un`, `pw`, `bl`) VALUES ('",TextUN,"', '",TextPW,"', '",0,"')"
    )
  dbGetQuery(con, sql)


Solution:

sql <-
    paste0(
      "INSERT INTO `devharsh` (`un`, `pw`, `bl`) VALUES ('",TextUN$getText(),"', '",TextPW$getText(),"', '",0,"')"
    )


Note:

It was giving error because it was not getting text from textbox that we should get by getText() function.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.