like this:
| id | name | num | name2 |
| 1 | aaa | 4 | ddd |
| 2 | bbb | 6 | null |
| 3 | ccc | 1 | aaa |
| 4 | ddd | 5 | |
| 5 | eee | 2 | |
| 6 | 3 |
i want to compare id and num columns so that respective value must be display in name2 column
| id | name | num | name2 |
| 1 | aaa | 4 | ddd |
| 2 | bbb | 6 | null |
| 3 | ccc | 1 | aaa |
| 4 | ddd | 5 | |
| 5 | eee | 2 | |
| 6 | 3 |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 11, 2014, 10:27 AM
samantaPosted Apr 11, 2014, 10:16 AM
VulpesPosted Apr 11, 2014, 10:11 AM
Also is it safe to assume that all rows will have a value in the id column and that the id's will be consecutive starting from 1 ?
samantaPosted Apr 11, 2014, 10:02 AM
Object reference not set to an instance of an object.
VulpesPosted Apr 11, 2014, 9:52 AM
So I'd try replacing:
int num = (int)row.Cells["num"].Value;
with:
int num = Convert.ToInt32(row.Cells["num"].Value.ToString());
samantaPosted Apr 11, 2014, 9:28 AM
Specified cast is not valid.
VulpesPosted Apr 11, 2014, 9:24 AM
samantaPosted Apr 11, 2014, 8:16 AM
samantaPosted Apr 11, 2014, 8:13 AM
Munesh SharmaPosted Apr 11, 2014, 8:10 AM
but you have to do some changes here see this.
samantaPosted Apr 11, 2014, 8:02 AM
Munesh SharmaPosted Apr 11, 2014, 8:01 AM
samantaPosted Apr 11, 2014, 7:55 AM
Munesh SharmaPosted Apr 11, 2014, 7:54 AM