Click here to Skip to main content
16,019,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to access value from two different table in single command by using union or join and that display in gridview
Posted

If the table structures are similar, use a UNION clause[^] in the query itself and use just one command.

If the tables have a common key, use a JOIN clause[^].
 
Share this answer
 
Comments
ProEnggSoft 22-Mar-12 11:40am    
To the point. 5!
Abhinav S 22-Mar-12 13:26pm    
Thank you.
Espen Harlinn 22-Mar-12 13:11pm    
5'ed!
Abhinav S 22-Mar-12 13:26pm    
Thank you.
If you are using LINQ see the examples here http://code.msdn.microsoft.com/windowsdesktop/101-LINQ-Samples-3fb9811b[^]

If by "single command" you mean a stored procedure or SQL statement. Then there are numerous resources that cover it.
 
Share this answer
 
Comments
ProEnggSoft 22-Mar-12 11:36am    
Good link for LINQ examples. 5!
Espen Harlinn 22-Mar-12 13:11pm    
Nice link :-D

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