Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2010, 06:04 AM
Authorized User
 
Join Date: May 2007
Posts: 95
Thanks: 5
Thanked 0 Times in 0 Posts
Default comparing two datatables

Hi all

i am developing web apps using C# and asp.net 2.0. I am using framework 2.0
i have two datatables both of them are having equal no. of columns namely EmployeeId,Designation and Remarks. Tables are T1 and T2. I want to have records from both of them and need to store in a new datatable. I have the following query which actually needs to be used here:

Code:
select a.empno,b.designation,b.remarks from t2 a left outer join t1 b
on a.empno = b.empno
Please throw some light how to do it in C#/ado.net
 
Old April 26th, 2010, 08:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi...

That query will show records that are the same on the two tables.. you need differents ones only???
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old October 31st, 2011, 01:22 AM
Registered User
 
Join Date: Oct 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use LINQ if you are coding under with C# 3 and or .NET. It’s a very powerful language feature, with support for quering objects and memory. So you can just do simple queries from you DB o your app with SELECT * FROM ..., then fill them in their respective collections then you can use LINQ to manage and compare them very easily. If that sounds simpler to you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTables and Visual Studio DeaconKen VB.NET 2002/2003 Basics 1 January 29th, 2007 12:33 PM
Need Help With DataTables visanza Beginning VB 6 1 January 9th, 2007 01:30 PM
How to merge two datatables????????? avats ADO.NET 3 March 21st, 2006 08:40 AM
2 x DataTables and Datagrid Vince ADO.NET 0 September 22nd, 2003 08:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.