Fetching multiple tables into dataset based on datetime

Posted by Xperiment under ASP.NET on 9/13/2010 | Points: 10 | Views : 1595 | Status : [Member] | Replies : 1
Hi, I need a little complicated code. I have 3 tables. I want to display all three tables on home page using dataset. but the condition is I want them to be displayed according to datetime. I.e. they tables should NOT be displayed like
table1
row1col1,row1col2,row1col3
row2col1,row2col2,row2col3
table2
row1col1,row1col2,row1col3
row2col1,row2col2,row2col3
table 3
row1col1,row1col2,row1col3
row2col1,row2col2,row2col3
...

Instead their records should be displayed according to the time. So should be random records according to timeline. like this

row2col1,row2col2,row2col3 (table3)
row1col1,row1col1,row1col1 (table2)
row4col1,row4col2,row4col3 (table3)
row2col1,row1col2,row1col3 (table1)
.
.
.
.
and so on...


thanks




Responses

Posted by: Peermohamedmydeen on: 9/14/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Let us consider three DataTables dt1,dt2 and dt3 in which you are having your Data.

DataTable dtFinal = dt1.Clone();


DataTable dtTemp = dt1.Select("Your TimeLine Condition","Sorting");
dtFinal.Merge(dtTemp);
dtTemp = dt2.Select("Your TimeLine Condition","Sorting");
dtFinal.Merge(dtTemp);
dtTemp = dt3.Select("Your TimeLine Condition","Sorting");
dtFinal.Merge(dtTemp);



Now dtFinal will have your required data.

If you are having 3 tables in a dataset, put the table index with dataset.


Dont forget to dispose the temp table at last.





Xperiment, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response