Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to reformat the data without going back to the database and in a dynamic way So that the user can specify what columns he wants to collect

What I have tried:

how I can Write an sql string and execute it like EXECUTE IMMEDIAT in Oracle 
<pre lang="SQL">EXECUTE IMMEDIATE 'select field1 + field2 as f12 , field3 from table '

Inside C# Linq want to do a lock like combining two or more fields (multiply - merge...) ToTable It only allows me to specify the names of existing fields
C#
FillDataSorce(params classP[] P)
{
 BSo.DataSource = from d in dt.AsEnumerable()
                    select new 
                    {
                       P.Select(p => p) //col3col2 = d["col1"] + d["col2"] Dynamic field example
                       
                    };
}
Posted
Updated 13-Feb-22 21:47pm

1 solution

If i understand you well, you want to copy data from one data source to another and add some extra data. Take a look here: DataTableExtensions.CopyToDataTable Method (System.Data) | Microsoft Docs[^]
 
Share this answer
 
Comments
khaled bash 14-Feb-22 5:22am    
This is not what I want
I want Linq dynamic query
I can change the fields according to the input
Without going back to the database
writing sql string
I was free to work with databases
Maciej Los 14-Feb-22 5:32am    

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