.. how can I compare both datagridview by using ID?As you can see, I want to compare both datagridview based on their id, for example id 1,2 are in both the datagridview... so i want help how to compare both the datagridview...if the id match I want the value in the Inquiry column to be sent to another datagridview...for example Inquiry value 8989 and 1111 to be sent to another datagridview...can anyone help me out??? thanks
comparing data from datagridview c#
Page 1 of 13 Replies - 566 Views - Last Post: 04 October 2012 - 12:08 AM
#1
comparing data from datagridview c#
Posted 03 October 2012 - 07:41 PM
pls look the image at the attachments
.. how can I compare both datagridview by using ID?As you can see, I want to compare both datagridview based on their id, for example id 1,2 are in both the datagridview... so i want help how to compare both the datagridview...if the id match I want the value in the Inquiry column to be sent to another datagridview...for example Inquiry value 8989 and 1111 to be sent to another datagridview...can anyone help me out??? thanks
.. how can I compare both datagridview by using ID?As you can see, I want to compare both datagridview based on their id, for example id 1,2 are in both the datagridview... so i want help how to compare both the datagridview...if the id match I want the value in the Inquiry column to be sent to another datagridview...for example Inquiry value 8989 and 1111 to be sent to another datagridview...can anyone help me out??? thanks
Replies To: comparing data from datagridview c#
#2
Re: comparing data from datagridview c#
Posted 03 October 2012 - 09:57 PM
What's wrong with a simple iteration with through one DataGridView's rows and comparing against the other DataGridView's rows, if the number of rows is small? It'll be an O(n^2) operation, but if n is small, it shouldn't matter too much.
You can use a a Dictionary to insert all the ID and corresponding Inquiry values. The actual lookup's will be O(1), but I think overall, it'll be an O(n) to initially insert the keys and values from one DataGridView, and then perform the lookup using the ID's from the other DataGridView.
You can use a a Dictionary to insert all the ID and corresponding Inquiry values. The actual lookup's will be O(1), but I think overall, it'll be an O(n) to initially insert the keys and values from one DataGridView, and then perform the lookup using the ID's from the other DataGridView.
This post has been edited by Skydiver: 03 October 2012 - 09:58 PM
#3
Re: comparing data from datagridview c#
Posted 03 October 2012 - 11:59 PM
Skydiver, on 03 October 2012 - 09:57 PM, said:
What's wrong with a simple iteration with through one DataGridView's rows and comparing against the other DataGridView's rows, if the number of rows is small? It'll be an O(n^2) operation, but if n is small, it shouldn't matter too much.
You can use a a Dictionary to insert all the ID and corresponding Inquiry values. The actual lookup's will be O(1), but I think overall, it'll be an O(n) to initially insert the keys and values from one DataGridView, and then perform the lookup using the ID's from the other DataGridView.
You can use a a Dictionary to insert all the ID and corresponding Inquiry values. The actual lookup's will be O(1), but I think overall, it'll be an O(n) to initially insert the keys and values from one DataGridView, and then perform the lookup using the ID's from the other DataGridView.
I dont understand what are u trying to say... I am a beginner for c# only
#4
Re: comparing data from datagridview c#
Posted 04 October 2012 - 12:08 AM
The comments I made about O(n), O(1), and O(n^2) were notes about how potentially expensive the set of steps will be. Ignore them for now.
Just focus on getting the IDs from each row of one DataGridView and comparing them against the IDs found in the other DataGridView.
What book are you reading, or what tutorial are you following to learn C#?
Just focus on getting the IDs from each row of one DataGridView and comparing them against the IDs found in the other DataGridView.
What book are you reading, or what tutorial are you following to learn C#?
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|