Case 1
DataSet oDsParent = new DataSet();
DataTable odt = new DataTable();
odt.Columns.Add(new DataColumn("DOC_GENO_KEY", typeof(int)));
odt.Columns.Add(new DataColumn("RESOURCE_TYPE", typeof(string)));
odt.Columns.Add(new DataColumn("ROUTING_SUB_ID", typeof(int)));
odt.Rows.Add(2, "TEST1", 2);
odt.Rows.Add(4, "ADMIN", 2);
odt.Rows.Add(7, "TEST2", 2);
oDsParent.Tables.Add(odt);
oDsParent.AcceptChanges();
string sTemp =new string ();
sTemp = "(DOC_GENO_KEY = 4 OR DOC_GENO_KEY = 2) AND (RESOURCE_TYPE = 'TEST1' OR DOC_GENO_KEY = 2 OR ROUTING_SUB_ID = 2)";
Case 2
oDsParent = new DataSet();
odt = new DataTable();
odt.Columns.Add(new DataColumn("DOCUMENT_ATTACHED", typeof(string)));
odt.Columns.Add(new DataColumn("ATTACHMENT TYPE", typeof(int)));
odt.Rows.Add("DOC1", 2);
odt.Rows.Add("DOC2", 1);
odt.Rows.Add("DOC3", 0);
oDsParent.Tables.Add(odt);
oDsParent.AcceptChanges();
sTemp = "(DOCUMENT_ATTACHED = 2 OR DOCUMENT_ATTACHED = 1 )";
The dataset oDsParent is formed dynamically In Case 1 there are 3 columns and their respective data & in Case 2 there are 2 columns with the data. These columns are filled based on condition in the same dataset(oDsParent) dynamically so that the columns formed are different at each time. I need to Query the dataset based on the string( sTemp) below which also changes according to the data tables based on the condition. I cannot use Field("Column name") in the query as there are no fixed columns and they change dynamically. i need a LINQ that can be used generally to filter the dataset no matter which columns are created according to their respective string. I have created a demo of the dataset & string to understand my issue better.