I have a list with column "English Desc". How do I read it in my web part?
I can see that in web part, this item has other properties such as item.ID, item.Name, item.Url but this property/column is not there.
EDIT
This is my code. I have changed column name from "English Desc" to "EnglishDesc" in my list just to keep it simple. Getting error "Value does not fall within the expected range." on line MessageBox.Show
String siteName = "http://win-qmdf4x092kh/sites/mysite";
String listName = "Announcements";
String viewName = "All Items";
SPSite site = new SPSite(siteName);
SPWeb web = site.OpenWeb();
SPList list = web.Lists[listName];
SPQuery query = new SPQuery(list.Views[viewName]);
query.RowLimit = 1;
String caml = "";
caml = "<orderby>";
caml += "<fieldref name=\"created\" ascending=\"false\" />";
caml += "</orderby>";
query.Query = caml;
query.ViewFields = "<FieldRef Name=\"EnglishDesc\"/>";
SPListItemCollection result = list.GetItems(query);
foreach (SPListItem i in result)
{
MessageBox.Show(i["EnglishDesc"].ToString());
}