471,338 Members | 1,030 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

DataRowCollection.Find

When calling the Find function of a DataRowCollection, one has two options:

Overloads Public Function Find(ByVal key As Object) As DataRow
or
Overloads Public Function Find(ByVal keys() As Object) As DataRow

This function is easy to use if the primary key of your DataTable consists
of only one field. How can you use the Find functions if the primary key
consists of two database fields (composite key)?

Thanks in advance,

Scott Adams
Jul 22 '05 #1
2 5534
Scott,

You want to use the second implementation of this method.

A code sample can be found in the MSDN library:
http://msdn.microsoft.com/library/de...findtopic2.asp

Basically you pass in an array of objects that contain values that you want
to find in the DataTable's primary key columns.

You may also have to set the Primary Key property of your DataTable from
which the DataRowCollection is coming.

A code sample for this can also be found in MSDN library:
http://msdn.microsoft.com/library/de...rykeytopic.asp

Hope it helps.

--
Cheers,

Jonathan

"Scott Adams" wrote:
When calling the Find function of a DataRowCollection, one has two options:

Overloads Public Function Find(ByVal key As Object) As DataRow
or
Overloads Public Function Find(ByVal keys() As Object) As DataRow

This function is easy to use if the primary key of your DataTable consists
of only one field. How can you use the Find functions if the primary key
consists of two database fields (composite key)?

Thanks in advance,

Scott Adams

Jul 22 '05 #2
Great. That was the key <no pun intended>. Thanks!

Scott
"Jonathan Mast" <jm***@lucruminc.com.dontspammeplease> wrote in message
news:4B**********************************@microsof t.com...
Scott,

You want to use the second implementation of this method.

A code sample can be found in the MSDN library:
http://msdn.microsoft.com/library/de...findtopic2.asp

Basically you pass in an array of objects that contain values that you
want
to find in the DataTable's primary key columns.

You may also have to set the Primary Key property of your DataTable from
which the DataRowCollection is coming.

A code sample for this can also be found in MSDN library:
http://msdn.microsoft.com/library/de...rykeytopic.asp

Hope it helps.

--
Cheers,

Jonathan

"Scott Adams" wrote:
When calling the Find function of a DataRowCollection, one has two
options:

Overloads Public Function Find(ByVal key As Object) As DataRow
or
Overloads Public Function Find(ByVal keys() As Object) As DataRow

This function is easy to use if the primary key of your DataTable
consists
of only one field. How can you use the Find functions if the primary key
consists of two database fields (composite key)?

Thanks in advance,

Scott Adams

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Marc Pelletier | last post: by
reply views Thread by Steve Richter | last post: by
2 posts views Thread by Scott Adams | last post: by
reply views Thread by Derek | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.