Still struggling with R, especially with error handling:
If I use:
result <- try(sqlSave(ch,df,tablename="tblTest"))
I can use:
if (class(result) != "try-error")
to check if something went wrong. No problem.
But if I use try in combination with a function it doesn't work as I expected:
result <- try(ch<-odbcConnect("TEST"))
gives "-1" for result and "integer" for class(result)
So should I use
ch<-odbcConnect("TEST")
if (ch != -1)
and use geterrmessage() for the error message?