LINQ over DataSet
-
I have an XML file that I need to run a LINQ query against and return some values. What I am doing is reading the XML file into a DataSet and then execute the query, the problem is that the DataSet gets two DataTables 0, 1. I need to check the CaseId and Password in Table[0] and display Notes from Table[1]. How would I query two tables using one LINQ query? My query goes something like this:
var query = from a in ds.Tables[0].AsEnumarable()
where a.Field("CaseId") == txtCaseId.Text && a.Field("Pwd") == txtPassword.Text
select new
{
CaseID = a.Field("CaseId"),
CaseManager = a.Field("CaseManager"),//HERE IS MY PROBLEM!! //HERE I NEED TO GET INFORMATION FROM TABLE\[1\] BASED ON THE CASEID IN TABLE\[0\] NoteCreated = ?.Field("NoteCreated"), }
Illegal Operation
-
I have an XML file that I need to run a LINQ query against and return some values. What I am doing is reading the XML file into a DataSet and then execute the query, the problem is that the DataSet gets two DataTables 0, 1. I need to check the CaseId and Password in Table[0] and display Notes from Table[1]. How would I query two tables using one LINQ query? My query goes something like this:
var query = from a in ds.Tables[0].AsEnumarable()
where a.Field("CaseId") == txtCaseId.Text && a.Field("Pwd") == txtPassword.Text
select new
{
CaseID = a.Field("CaseId"),
CaseManager = a.Field("CaseManager"),//HERE IS MY PROBLEM!! //HERE I NEED TO GET INFORMATION FROM TABLE\[1\] BASED ON THE CASEID IN TABLE\[0\] NoteCreated = ?.Field("NoteCreated"), }
Illegal Operation
How about something like this...
var query = from a in ds.Tables[0].AsEnumarable()
where a.Field("CaseId") == txtCaseId.Text && a.Field("Pwd") == txtPassword.Text && b.Field("CaseId") == txtCaseId.Text
select new
{
CaseID = a.Field("CaseId"),
CaseManager = a.Field("CaseManager"),
NoteCreated = b.Field("NoteCreated"),
}