+ 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

21st Nov 2017, 6:08 AM
Salman Mushtaq
Salman Mushtaq - avatar
3 Antworten
+ 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 });
21st Nov 2017, 7:36 AM
David Carroll
David Carroll - avatar
+ 3
Salman Mushtaq Did you forget to include the query you wanted me to convert?
25th Apr 2018, 5:42 AM
David Carroll
David Carroll - avatar
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
24th Apr 2018, 11:18 AM
Salman Mushtaq
Salman Mushtaq - avatar