searching record from DataTable
i have used below code to search from a data table that is retrieved from the viewstate. However when i use the = sign in the expression, it is not returning any values for the search. However if i use > sign, it returns all the values. Can anyone let me know if I am doing anything wrong:
DataTable myDT =(DataTable) ViewState["myQuestions"];
myDT.PrimaryKey = new DataColumn[] { myDT.Columns["SlNo"] };
String expr = "slNo=3";
DataRow[] foundRows = myDT.Select(expr);
for (int i = 0; i < foundRows.Length; i++)
{
lblSlNo.Text =Convert.ToString (foundRows[i]["SlNo"]);
}
}
|