I have written following code to compare the records of DataSet (i.e.) record of one column. And I am getting following Exception:
ex:" Index was outside the bounds of the array."
public void GetRunningTask()
{
// Process[] lstprocess = Process.GetProcesses();
conn=new SqlConnection("Data Source=.; Initial Catalog='TTES'; Integrated Security=SSPI;");
da=new SqlDataAdapter("Select AppName from LRNSetting", conn);
ds=new DataSet();
da.Fill(ds,"LRNSetting");
// Process[] lstprocess = Process.GetProcesses();
for (int k = 0; k < ds.Tables[0].Rows.Count; k++)
{
Process[] lstprocess = Process.GetProcesses();
// DataRow dr=ds.Tables[0].Rows.Cast<DataRow>().Single(row=>row["AppName"])
var pro = from p in lstprocess
//where p.ProcessName.Contains("LRCDual")
//where p.ProcessName.Contains(ds.Tables[0].Rows[k].ItemArray) //added temporary
where (p.ProcessName.Contains(ds.Tables[0].Rows[0].ItemArray[k].ToString()))
select p;
}
}