Jun 22, 2008 06:09 AM|zx6r|LINK
You have the code right to access the DB. But the function is declared as static, which is creating the compile error. static functions cannot access non-static fields or functions.
Simply remove the static declaration or store the result/s in a local variable and return the result.