This works But........

  • Thread starter Thread starter scorpion53061
  • Start date Start date
S

scorpion53061

select SLSMN, sum(SALESAMT) from yourtable Group By SLSMN

will work when pulling data from a SQL database table. It totals all
salesman's sale amounts and groups it by them.

How could I acomplish this in a datatable where I have already added the
rows but without having to send the rows to the database?
 
Iterate through the column SALESAMT and add as you go through it.

DataRow dr;
int i; //or whatever value you need to store it as

foreach dr in myTable.Rows:
dr.Columns("SALESAMT").Value ++
next
 
If I'm understanding what you want to do correctly, you can iterate through
the table and break/reset counters each time a SLSMN changes. I wasn't sure
if that's the query you are firing or it you were firing a query with all
the data and you wanted to aggregate client side. If it's the latter, the
basic logic should work for you. If it's the former, then I probably
misunderstood what you want to do...but will gladly give a shot at figuring
it out.

Cheers,

Bill
 
Back
Top