Q:
I have the following case and i need the best performance answer:
i will use advanced control like gridview or schedule , and the data that is supposed to be bound to this control is : data from set of tables in my database.not a single table.
what is the best form for this data?
what i thought about at first is:
stored procedure ,contains my logic (and i wanna to ask here about what is the best performance also)use temporary table or joins or … etc.
what are the possible solutions and more performance rather than stored procedure( as this is a web application many users will use it).
i will be grateful if there is an example to clarify the idea.
thanks in advance.
The most common way would be to join the tables in an sql stored procedure, performance is not typically an issue unless you are joining many many tables or using a number of nested select statements.
However, if you really need an alternative, you could load data from each table individually (possibly into representative objects i.e. a user object for each row of data from the user table) and then create a data structure to house a combination of the data (i.e. if you have user objects and schedule objects, you could create a UserSchedule object) then you could bind your control to a list of these secondary objects.
EDIT
Since you seem to really not want to use stored procs. How about a compromise?
You could use LINQ to entities to join multiple sets of data within C# after getting them all from the DB separately.
Here is an example:
And here is a link to more info.