Linq join with more than one condition? -


in linq trying

select * tbl1 join tbl2 on tbl1.column1= tbl2.column1 , tbl1.column2 = tbl2.column2 

how can write above query in linq.... tried giving error

  var sasi = table1 in dtfetch.asenumerable()              join table2 in dssap.asenumerable()               on new {                  table1.field<string >["sapquotationno"],                 table1.field<string >["invoiceno"]}               equals new {                   table2.field<string>["sapquotationno"],                 table2.field <string>["invoiceno"]              } 

  • use anonymous types
  • give properties names
  • select
  • use datarow.field method round brackets

var sasi = table1 in dtfetch.asenumerable()            join table2 in dssap.asenumerable()             on new             {                 sapquotationno = table1.field<string>("sapquotationn"),                invoiceno = table1.field<string>("invoiceno")            } equals new             {                sapquotationno = table2.field<string>("sapquotationno"),                invoiceno = table2.field<string>("invoiceno")             }            select table1; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -