IT would help to know what you're doing this in, what framework, etc, and to see where your data connection is defined.
Having said that, when I get an error message I don't understand or cannot resolve, I do
this[
^] to find out what is wrong and how to fix it.