Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Select 0 NBRANCH_SL, 0 NCM_SL,'' CNAME Union ALL Select NBRANCH_SL,NCM_SL,CNAME from CM_MT_REF_CODE
Posted

1 solution

Its not as simple as just creating single LINQ statement, because you will actually need to create 3 statements.

An example is given here.

Personally I think the example is a little obtuse.

My example would be to create a specific type of the object you want to use.

C#
public class CM_MT_REF_CODE
   {
       public Int32 NBRANCH_SL { get; set; }
       public Int32 NCM_SL { get; set; }
       public string CNAME { get; set; }
   }


Then create your initial element, add it to a list, do your query, then add the range to your list.

C#
List<CM_MT_REF_CODE> results = new List<CM_MT_REF_CODE>();
var query = from CM_MT_REF_CODE c in table
            select c;
results.Add(new CM_MT_REF_CODE { CNAME = "<Select>" });
results.AddRange(query);

//use results
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900