Anita Srivastav

Anita Srivastav

  • NA
  • 21
  • 15k

regarding SQL and ASP

Dec 25 2013 4:50 AM
i have a table wchich has two columns named as 'sl.no.' and  'total'
and it has 5 values in rows like 
    sl.no     total
      1           3
      2           5
      3           2                         
      4           3
      5           4
now i want to add only the rows starts from sl.no -2 to sl.no -4
 
i an using this code but its not working please let me out
object sumobject 
for (p = 2; p <= 4; p++)
{
DataTable dt;
dt = dsu.Tables[username.Text];
sumobject = dt.Compute("sum(total)", "sl.no=" + p + "");
}
reasoning0.Text = sumobject.ToString();
 

Answers (2)