If you need to retrieve items from a list when developing web parts, application pages or custom field types you can best use the SPQueryobject from the SharePoint object model. This object is located in the Microsoft.SharePoint namespace of the Microsoft.SharePoint.dll located in the Global Assembly Cache.
Instantiate the object as follows:
SPQuery qry = new SPQuery();
The most important property is the Query property, which needs to be set to your CAML query:
string camlquery = "<OrderBy><FieldRef Name='Country' /></OrderBy><Where>"
+ "<Eq><FieldRef Name='LastName' /><Value Type='Text'>Smith</Value></Eq>"
+ </Where>";
qry.Query = camlquery;
At this point you can execute the query on your list:
SPListItemCollection listItemsCollection = list.GetItems(qry);
A small remark with the GetItems method of the SPList instance: this method returns a collection of type SPListItemCollection. It is possible that it is easier working with a DataTable. In that case you can execute the query as follows:
DataTable listItemsTable = list.GetItems(qry).GetDataTable();
Hope this will help you.