What does ds.Tables [0] .Select () do
It returns an array of DataRow that matches the selection criteria expressed by the first parameter of the Select method
DataRow[] dr = objds.Tables[0].Select("ProcessName = '" + tnProcName.Text + "'");
foreach(DataRow r in dr)
{
string procName = r["ProcessName"].ToString();
treeView1.Nodes.Add(procName);
}
The choice has four overloads for fine-tuning the results.
DataTable.Select(); // return all (same as dataTable.Rows)
DataTable.Select(filter); //The above one
DataTable.Select(filter, sort) //Filtered and/or sorted
DataTable.Select(filter, sort, rowstate) // Filtered and/or sorted and/or in a particular state
This may not be your case, but keep in mind that if the expression parameter has a single quote, you need to double it to avoid a syntax error when evaluating the expression
DataRow[] dr = objds.Tables[0].Select("ProcessName = '" +
tnProcName.Text.Replace("'", "''") + "'");