473,322 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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 5643
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Derrick | last post by:
Hi all, I've been trying to understand exactly how to insert a newly created DataRow into a DataRowCollection at a specified row value without much luck. At first I was just appending the...
4
by: Marc Pelletier | last post by:
Hello, I am trying to use the find method to locate a particular record in a table. The code is : objectfindTheseVals = new object; findTheseVals = station_ID; // an integer findTheseVals =...
0
by: Steve Richter | last post by:
how do I sort the Rows DataRowCollection of a DataTable? I have sub classed the DataRow class and added the IComparable interface: public class ResultsTableRow : System.Data.DataRow,...
2
by: Scott Adams | last post by:
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...
0
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
2
by: Bill Nguyen | last post by:
What do I need to do to add a row to a table with single column? I got the "mnarrowing conversion" ewrror mesage. Thanks Bill -----------------
2
by: George | last post by:
Hi, I have encountered the following problem. Say I have the following, DataGridView dgv; DataTable dt; OleDbDataAdapter oleDb_da; (bound to a OleDb data connection)
3
by: Carlos | last post by:
Hi all, I have 2 asp .net 2.0 projects currently being developed. One is in VB .Net and the other in C#. In the VB .Net project I can cross-reference a datatable object using the...
0
by: ileving | last post by:
Hi, my name is Iram. I'm upgrading my winform application which was developed in .NET 1.1 to .NET 2. There is a code section that works well in .NET 1.1, but in .NET 2 raises an Exception...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.