EXTRHMAN
asked on
creating a dataview with grouping from a datatable
Hi experts,
I have an application that displays product usage information by year in a datagridview. This typically displays about 150k of records. I am trying to create an option to group by product (meaning sum up all the years info). I would like for the user to just select a radio button to change the grouping. I can run different SQL statments each time but thought there may be a better way, since I have the data already.
Can I create a new view on the table that includes the grouping or is there a way to run an sql statement against the datatable instead of requering the sql server?
Thanks
Mike
I have an application that displays product usage information by year in a datagridview. This typically displays about 150k of records. I am trying to create an option to group by product (meaning sum up all the years info). I would like for the user to just select a radio button to change the grouping. I can run different SQL statments each time but thought there may be a better way, since I have the data already.
Can I create a new view on the table that includes the grouping or is there a way to run an sql statement against the datatable instead of requering the sql server?
Thanks
Mike
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Dhaest
That was an excellent find and it worked like a charm.
That was an excellent find and it worked like a charm.
One possibility is to return two resultsets from your initial query, one being the unsummed data and the other the summary data. You can then simply switch datatables on the radio button event to avoid having to requery each time this is clicked. It might slightly increase your load time but will avoid the requerying.