Compare values from two datasets

O

Ondrej Sevecek

Hello,
I would like to compare two values in different datasets with no previous
knowledge of their type nor format...

dataset1.Tables[5].Rows[10]["CollumnName"] = =
dataset2.Tables[3].Rows[8]["OtherCollumn"]

Ondra.
 
G

Guest

Will this suffice for your purposes

dataset1.Tables[5].Rows[10]["ColumnName"].equals(dataset2.Tables[3].Rows[8]["OtherColumn"])
 
O

Ondøej ©eveèek

I thought that Equals() compares object pointer values, not contents of the
field, doesn't it?

Ondra.


Blake said:
Will this suffice for your purposes?
dataset1.Tables[5].Rows[10]["ColumnName"].equals(dataset2.Tables[3].Rows[8][
"OtherColumn"])
 
G

Guest

I don't think so. I believe Equals() is something that can actually be overridden so that each object can define its own implementation of Equals().

I just ran a test where I filled two different DataSets with the same query from the database, and the following expression retruns true:

dataSet1.Tables[0].Rows[0]["TestTableID"].Equals(dataSet2.Tables[0].Rows[0]["TestTableID"])
 
M

Miha Markic

Hi,

Equals should do the same as == operator.
Excerpt from help:
a.. Override the Equals method whenever you implement ==, and make them do
the same thing. This allows infrastructure code such as Hashtable and
ArrayList, which use the Equals method, to behave the same way as user code
written using ==.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

Blake said:
I don't think so. I believe Equals() is something that can actually be
overridden so that each object can define its own implementation of
Equals().
I just ran a test where I filled two different DataSets with the same
query from the database, and the following expression retruns true:
dataSet1.Tables[0].Rows[0]["TestTableID"].Equals(dataSet2.Tables[0].Rows[0][
"TestTableID"])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top