+ 2
Normal Query to Linq
Hello, I have query string query = "SELECT OBIS_CODE.OBIS_CODE, OBIS_CODE.READING, EXPLANATION.EXPLANATION FROM OBIS_CODE CROSS JOIN EXPLANATION WHERE OBIS_CODE.OBIS_CODE = EXPLANATION.OBIS_CODE"; I need to make this query in linq IEnumerable<DataRow> query = ? Please help
3 odpowiedzi
+ 5
@Salman: Try these two variations of LINQ (standard query style and fluent query style)
var query = from o in OBIS_CODE
join e in EXPLANATION
on o.OBIS_CODE equals e.OBIS_CODE
select new {
o.OBIS_CODE, o.READING, e.EXPLANATION
};
var fluent = OBIS_CODE.Join(
EXPLANATION,
o=>o.OBIS_CODE,
e => e.OBIS_CODE,
(o, e) => new {
o.OBIS_CODE, o.READING, e.EXPLANATION
});
+ 3
Salman Mushtaq Did you forget to include the query you wanted me to convert?
0
@David, can you please tell me how I convert below query to linq. Its very similar to my previous query just 1 addition of adding sub string part. Advance thanks