Click here to Skip to main content
14,665,547 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hey guys

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

Rate this:
Please Sign up or sign in to vote.

Solution 1

Have you looked at the JOIN clause?
http://www.w3schools.com/sql/sql_join.asp[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

This can only be done if the schema from both queries are the same, use union in your queries:
select * from table1 
union 
select * from table2
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

private void MergeDataTabels(DataTable dtSource, DataTable dtDest)
        {
            if (dtSource.Columns.Count == dtDest.Columns.Count)
            {
                dtDest.Merge(dtSource);
            }
        }
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100