473,327 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

get summation of a table column using wpf quary

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
0 1099

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

Similar topics

3
by: Martin Lucas-Smith | last post by:
Can anyone point me to a regular expression in PHP which could be used to check that a proposed (My)SQL database/table/column name is valid, i.e. shouldn't result in an SQL error when created? ...
1
by: chelleybabyger | last post by:
Using the below method, <% remaining_stock = cint(product_stock) - cint(chQuantity) %> <% sqlString = "UPDATE Products SET " &_ "product_stock='" & remaining_stock & "'," &_ "WHERE...
3
by: Albretch | last post by:
I am trying to insert some textual data belonging to an HTML page into a table column with 'TEXT' as data type mysql's maual _/manual.html#String_types tell you, you may insert up to (2^16 - 1),...
0
by: Dr. Laurence Leff | last post by:
I am having trouble with tables under docbook. I am using xmlto under Redhat Linux. When I process a simple table as below, I get an error message about the Unit of Measure. If I change the...
2
by: Ron Nolan | last post by:
Re: Access 2000 Does anyone know how to add column to a table using ADO? I need to add a column called "autonum" that has a datatype of "AutoNumber" to a table called "MyTbl". I have searched...
1
by: VMI | last post by:
How can I sort a table column correctly when the table has values like "0", "A1", "AA-1", "B21", "3C", 4-32A", "1", "11-1", 2-A", etc... The table will then be loaded to a grid and that's when...
4
by: Justin | last post by:
Using an SqlDataReader what is the best way to determine if a table column has specified value? Thanks, Justin.
4
by: Scot L. Harris | last post by:
Currently using Postgresql 7.2.4-5.80 with php 4.2.2.-8.0.8 on a redhat 8.0 system. I am writing some php scripts where I want to generate a list of the column names in a particular table that...
8
by: mguy27 | last post by:
We have about 2 dozen security officers who patrol about 120 buildings. They find defective or unlocked doors and write a "Trouble Report" on the door. This card gets turned in, where I have designed...
8
by: gigonomics | last post by:
Hi all, I hope someone can help me out. I need to return the best available seats subject to the constraint that the seats are side by side (or return X consecutive records from a table column...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.