jeudi 17 mai 2018

if...then to concat SQL queries, equivalent in LINQ - VB NET

I have simply code:

 Dim query as string = "SELECT id, red, yel, gre FROM table WHERE"
 if a then query=query + " red=true OR"
 if b then query=query + " yel=true OR"
 if c then query=query + " gre=true"
 if right(query,2)="OR" then query=left(query,len(query)-3)

How to make equivalent in LINQ ?

Aucun commentaire:

Enregistrer un commentaire