query using Lamda expression
-
Hello Listeners, I created a SL application (using C#) that returns contents of a table in SQL database. Table has 5 columns (FirstName, LastName, Age..etc). --A grid is populated with following: EclipseMTXDomainContext context = new EclipseMTXDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context.GetDBTablesQuery()); --Mine domain service has an entry as follows: public IQueryable GetDBTablesCompare() { return this.ObjectContext.DBTables; } This works fine but What I am trying to do now is load only two columns at a time so I added this in the domain services public IQueryable GetTwoColms(string db1,string db2) { return this.ObjectContext.DBTables.Where(P => P.col1Name == cl1 && P.col2Name == cl2); } --And the main program, added this to a button action EclipseMTXDomainContext context = new EclipseMTXDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context. GetTwoColms Query("LastNames","FirstName")); It does not fail but it does not return anything either. Any help is greatly appreciated
-
Hello Listeners, I created a SL application (using C#) that returns contents of a table in SQL database. Table has 5 columns (FirstName, LastName, Age..etc). --A grid is populated with following: EclipseMTXDomainContext context = new EclipseMTXDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context.GetDBTablesQuery()); --Mine domain service has an entry as follows: public IQueryable GetDBTablesCompare() { return this.ObjectContext.DBTables; } This works fine but What I am trying to do now is load only two columns at a time so I added this in the domain services public IQueryable GetTwoColms(string db1,string db2) { return this.ObjectContext.DBTables.Where(P => P.col1Name == cl1 && P.col2Name == cl2); } --And the main program, added this to a button action EclipseMTXDomainContext context = new EclipseMTXDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context. GetTwoColms Query("LastNames","FirstName")); It does not fail but it does not return anything either. Any help is greatly appreciated
My first guess: You have the column names as
"LastNames"
(plural) and"FirstName"
(singular) which looks suspiciously like a typo. -
My first guess: You have the column names as
"LastNames"
(plural) and"FirstName"
(singular) which looks suspiciously like a typo. -
Hello Listeners, I created a SL application (using C#) that returns contents of a table in SQL database. Table has 5 columns (FirstName, LastName, Age..etc). --A grid is populated with following: EclipseMTXDomainContext context = new EclipseMTXDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context.GetDBTablesQuery()); --Mine domain service has an entry as follows: public IQueryable GetDBTablesCompare() { return this.ObjectContext.DBTables; } This works fine but What I am trying to do now is load only two columns at a time so I added this in the domain services public IQueryable GetTwoColms(string db1,string db2) { return this.ObjectContext.DBTables.Where(P => P.col1Name == cl1 && P.col2Name == cl2); } --And the main program, added this to a button action EclipseMTXDomainContext context = new EclipseMTXDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context. GetTwoColms Query("LastNames","FirstName")); It does not fail but it does not return anything either. Any help is greatly appreciated