View Single Post
  #1 (permalink)  
Old April 11th, 2012, 04:01 AM
knadig knadig is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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"]);
}
}