convert the string value to integer in dataTable select method

Aug 31 2010 4:58 AM
i have a one datatable in this i want to get the maximum userId no the values are 1,2,3,4,5,6,7,8,9,10...suppose i use max(userId) it always display 9 why because the column values is treat as string type that's why i want convert that string values into integers how to achive this one is there any way to solve this issue.....

my code:
 DataRow[] drs = ds.Tables[0].Select("UserId=MAX(CONVERT(Child.UserId,'System.Int32')");
                 var d =(object)ds.Tables[0].Compute("MAX(UserId)", "UserId>0");

Answers (5)