I have a small DataTable that contains a number of rows which I am running a LINQ query against.
I am having problems getting the LINQ to display the text that is in the datatable.
When I run it I can get the column name.
I have tried a number of different ways of doing it but to no avail.
Code as follows:
DataTable DTGetNarratives = DAL.GetNarrativeList();
var SelectedNarrative =
from n in DTGetNarratives.AsEnumerable()
where n.Field<string>("narr_code").Equals(ClsPublic.NarrativeCode)
select n;
foreach (var item in SelectedNarrative)
{
//test1.Add(item.Table.Columns[col].ToString());
//col++;
txtLine1.Text = item.Table.Columns[0].DefaultValue.ToString();
}
Any help on this would be great.