I’ve been using a nice Caml Builder that is used by the U2U Caml Builder(The most popular tool among the SharePoint developers) .
Its very easy to use and in my opinion a lot more secure and efective than manual writing the CAML.
For example if i want to do a simple query to get an item by a column, i’ll do something like this:
CamlBuilder batchBuilder = new CamlBuilder(CamlTypeEnum.GetListItems);
batchBuilder.AddWhereField("", DataTypeEnum.Text, CamlOperatorEnum.Eq, CamlCombinerEnum.And, out addCombinerTag);
SpWsListsProxy.GetListItems(listName, string.Empty, batchBuilder.QueryNode, null, "1", null, null);
Note: I’am not disposing the proxy for simplicity of code
In "batchBuilder.QueryNode" it will be the query xml without errors and it is assured that it will work…
If you want you can do a reverse engineer on the dll and copy the code to your own sharepoint framework if you like, it is no ofuscated…