Here is another small tip. If you get the following error, change the field name that you are using in your SPQuery to the "internal" field name and that should resovle your issue.
One of more field types are not installed properly
Well, I won't go into details as this is not a new topic and has been discussed several times on different blogs and forums but why I wanted to post this tip again was the reason that I have seen on different blogs where authors have mentioned that internal names should be used if there are spaces in the field name. That means if there are no spaces in the field name and you use the field name in the SPQuery, you shouldnt get this error. Right? That might work on your development machine but as soon as you move the solution to the staging or production environment, you start seeing this error and then you start scratching your head that there is nothing wrong with the query and you have already tested it in DEV environment then what is the cause of the error on other servers. You start fiddling with your database and other code that has no relationship whatsoever with the query code. So, the suggestion is to use the internal name in first place. That will work everywhere, on your DEV and also on staging and prod. You can use field.InternalName to get the internal name of the field where field is an SPField object. You can also use free tools like U2U CAML Builder to get the internal names of the fields. One last thing, I have often seen blogs where authors mention that simply replacing the space with _x0020_ will resolve the issue. the authors have also given the code that shows how you can replace space character with _x0020_ but again that might work in your DEV environment but not necessarily on prod servers. For example, following is the name of one field in my list:
fc5bb16d_x002d_5336_x002d_45a6_x002d_b6e5_x002d_0c9e8de73e26
The real field name is "CurrentActivityStatus". Note there are no spaces in this field name so I shall assume it will be safe to use this name in the code but no, you will get the error if you did not use the internal name.
Comments/feedback welcome!
Update:
Someone asked me how to get the internal name using code. Here iit is:
list.Fields[FIELD DISPLAY NAME].InternalName.ToString()
Here list is an instance of SPList object.