473,466 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 5650
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.