TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Riddhi Valecha
444
3.3k
412.7k
Comparing 2 datatables
Mar 16 2015 8:48 AM
Hi all...
I need help in comparing 2 datatables and then making column values null.
My Requirement -
1. I have 2 datatables -
datatable tableA = new datatable();
tableA = Method1(); //return type of Method1 is datatable.
datatable tableB = new datatable();
tableB = Method2(); //return type of Method2 is datatable.
2.
I have distinct values in tableA.
IN_NUMBER
122
12345
34567
123
456
I have multiple values in tableB.
IN_NUMBER
W_AMT
WH_AMT
Remarks
SrNo
122
10
100
Test
1
122
20
200
Test
2
12345
30
300
verified
3
12345
40
400
verified
4
34567
50
500
test
5
456
60
600
approved
6
123
70
700
approved
7
3. I need result as follows -
IN_NUMBER
W_AMT
WH_AMT
Remarks
122
10
100
Test
122
12345
30
300
verified
12345
34567
50
500
test
456
60
600
approved
123
70
700
approved
Logic -
I have to take IN_NUMBER Column values from tableA.
Say - 122
I need to check how many times it is appearing in tableB.
Here - 2 times.
Now, I need to keep the column values W_AMT, WH_AMT, Remarks in only one row for IN_NUMBER 122.
-------------------
For value 34567, I do not make any changes as it is appearing only once.
-------
Again for value 12345, I need to remove column values W_AMT, WH_AMT, Remarks from one row.
-------
In tableB, there is a SrNo (unique primary key).
----
How do I achieve this ?
Reply
Answers (
28
)
Can any one tell me what is the wrong in this code??
How to use AccessDataSource control in asp.net?