I am developing an app using c# and sql server 2008 to automate a sport club, and i almost done.
Now i am making reports for my app by creating stored procedure in sql server that returns the data fro c# app after passing some parameters, and the result of report like grouping, number of fields returned are changed depending on the sent parameters.
My question is better to do the grouping in sql server and return the last result and show it in c# report or get the data without grouping or sorting and do it in c# report you know in c# reports you can make groups and chose what fields to group by
Thanks in advance.
It depends. If LINQ is an option (meaning you are using the entity framework or aren’t using stored procedures), then you can programmatically change the
group byin your C# code while still performing the grouping on the server.If you cannot use LINQ/Entity model but your
group bycould change dynamically, perform the grouping at the application level so you can group the data however you need based on user parameters without using a billion different query options.Otherwise, perform it on the server because that reduces bandwidth consumption, is faster in terms of transfer time, and is faster in general because SQL (and general database) grouping is much faster than what you would be doing in C#.
Here are links of interest: