Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
DataSet dssa = (DataSet)Session["dt"];
       string sr = dssa.Tables[0].Columns[2].ColumnName;
       Response.Write(sr);
       object sumOfSalary = null;
       sumOfSalary = dssa.Tables[0].Compute("Sum(sr)" , " ");

the error was sumOfSalary = dssa.Tables[0].Compute("Sum(sr)" , " ");
can any one say me how to use the variable instead of column name.
Posted
Updated 7-Feb-11 21:31pm
v2

1 solution

Please check following

C#
sumOfSalary = dssa.Tables[0].Compute("Sum(" + sr +")" , " ");
 
Share this answer
 
Comments
gowdhami 8-Feb-11 2:51am    
i used like the error Invalid usage of aggregate function Sum() and Type: String. is generated

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900