|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Q: sum of columnHi
I'm using VS2003. I have a datatable and I want to sum the values in a column. At present I'm looping through the rows of the datatable and incrementing a variable with the values in the column. This works. However, I'm wondering if there is a faster way to do it? I'm working on a dataset rather than the SQL server itself so I can't use "SUM" i.e. I don't seem to be able to use the keyword "SUM" on a dataset/datatable. Can anybody help? Thanks Look into the DataTable Compute method. If you look at the documentation,
you can find the aggregate expressions supported. Show quoteHide quote "G .Net" <nodamnspam@email.com> wrote in message news:qu2dnb_78PEwbYrYnZ2dnUVZ8qKdnZ2d@pipex.net... > Hi > > I'm using VS2003. I have a datatable and I want to sum the values in a > column. At present I'm looping through the rows of the datatable and > incrementing a variable with the values in the column. This works. > However, I'm wondering if there is a faster way to do it? > > I'm working on a dataset rather than the SQL server itself so I can't use > "SUM" i.e. I don't seem to be able to use the keyword "SUM" on a > dataset/datatable. > > Can anybody help? > > Thanks > Hi Marina
Many thanks! Show quoteHide quote "Marina Levit [MVP]" <someone@nospam.com> wrote in message news:OWBoMZL4GHA.1252@TK2MSFTNGP04.phx.gbl... > Look into the DataTable Compute method. If you look at the documentation, > you can find the aggregate expressions supported. > > "G .Net" <nodamnspam@email.com> wrote in message > news:qu2dnb_78PEwbYrYnZ2dnUVZ8qKdnZ2d@pipex.net... >> Hi >> >> I'm using VS2003. I have a datatable and I want to sum the values in a >> column. At present I'm looping through the rows of the datatable and >> incrementing a variable with the values in the column. This works. >> However, I'm wondering if there is a faster way to do it? >> >> I'm working on a dataset rather than the SQL server itself so I can't use >> "SUM" i.e. I don't seem to be able to use the keyword "SUM" on a >> dataset/datatable. >> >> Can anybody help? >> >> Thanks >> > >
Copy Directory
Windows Service, timer doesn't tick split container Any examples of this floating around? Help with some research multi line list box How to close the parent and all child forms together at once when click on parent window's close but Run Adobe Acrobat from within VB.Net app Best sites for source code examples? Getting A generic error occurred in GDI+ message |
|||||||||||||||||||||||