Hi, I have a datagrid on winform in which I want to display the following
- State ID from table state
-
Description from table state
-
Country ID from table country
- Description from table country
Relation is state.countryid = country.countryid
and filter by flag=0 in both state and country tables. Tried as follows but I do not know the exact way of doing it.
private void PopulateGrid() // Load Data
{
#region Fill Grid with Database Table.Column Names and order
var statedatasource = new EntityCollection<StateEntity>(new StateEntityFactory());
var bucketstate = new RelationPredicateBucket();
using (var stateadapter = new DataAccessAdapter())
{
stateadapter.FetchEntityCollection(entityCollectionstate, null);
bucketstate.PredicateExpression.Add(StateFields.Flag == ClubCentricBISpecific.StandardFlag.recordvalidflag); // Filter by recordvalidflag
bucketstate.PredicateExpression.Add(StateFields.CountryId == CountryFields.CountryId);
bucketstate.PredicateExpression.Add(CountryFields.Flag == ClubCentricBISpecific.StandardFlag.recordvalidflag); // Filter by recordvalidflag
stateadapter.FetchEntityCollection(statedatasource, bucketstate, 0,
new SortExpression(StateFields.Description | SortOperator.Ascending));
dgridstate.DataSource = statedatasource;
stateadapter.CloseConnection();
}
Thanks and advance !
Regards, Shekar