Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
I wanted to minimize number of calls to the database, but get back results of dynamic query for small number of columns, as well as detailed data(e.g Itinerary table and Itinerary joined with Itinerary items) .In EntitySpaces
I've created a where condition, filled Query and loaded detailed data, then saved the returned table to DataSet.

Then  for the same query I've specified distinct select columns and Load it again(When LINQ will be available, it could be done in memory without extra database call).  Different table was created, that I've added to the same dataset. Below is code snippet:
                VwItinerariesCollection collPendingList = new VwItinerariesCollection();
                VwItinerariesQuery queryFilter = collPendingList.Query;
                queryFilter.AddWhereConditions();//custom code
                 collPendingList.Query.Load();
                 DataTable tbl= collPendingList.ConvertToDataTable();
                tbl.TableName = "ListWithDetailsTable";   
              DataSet  itineraries = new DataSet();
                itineraries.Tables.Add(tbl);
                 queryFilter.DistinctSelectForList();//custom code
                 collPendingList.Query.Load();
                 tbl = collPendingList.ConvertToDataTable();
                 tbl.TableName = "ListTable";
                 itineraries.Tables.Add(tbl);
Posted on Sunday, October 21, 2007 3:01 PM .Net Framework , Code Generation | Back to top


Comments on this post: EnitySpaces: the same Query can be used to save multiple tables

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net