Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys

I wonder how can I put two different SQL Select method in one datatable?
Posted

Have you looked at the JOIN clause?
http://www.w3schools.com/sql/sql_join.asp[^]
 
Share this answer
 
This can only be done if the schema from both queries are the same, use union in your queries:
SQL
select * from table1 
union 
select * from table2
 
Share this answer
 
C#
private void MergeDataTabels(DataTable dtSource, DataTable dtDest)
        {
            if (dtSource.Columns.Count == dtDest.Columns.Count)
            {
                dtDest.Merge(dtSource);
            }
        }
 
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