By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

get summation of a table column using wpf quary

P: 1
i have a table called matrixValues in there column called mtrxV_importance is a integer typed one i want to get the summation of the values in the column

i have tried it as follows but it didn't worked...

Expand|Select|Wrap|Line Numbers
  1.  public int getMatrixValue(string search)
  2.         {
  3.  
  4.          IQueryable<int> mx = from c in     DataContext.MatrixValues
  5.                                          where c.actv_reference.Contains(search)
  6.                                          select (Int32.Parse(c.mtrxV_importance.ToString()));
  7.  
  8.             List<int> list = mx.ToList();
  9.             int a = list.Sum();
  10.  
  11.  
  12.  
  13.             return a;
  14.         }
  15.  
  16. and i have called the method in button click evevnt
  17.  
  18.  private void button2_Click(object sender, RoutedEventArgs e)
  19.         {
  20.             DataAdapter dd = new DataAdapter();
  21.             int bb= dd.getMatrixValue("ACTV1");
  22.             string aa = bb.ToString();
  23.             textBox1.Text = aa.ToString();
  24.        }
how can i solve this?
May 19 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.