DataSet Find Command

M

MikeTI

October 14, 2009

Hi all

I want to find a row from a DataSet table whose primary field consists of
three fields:

Employee Character Field
Serial Integer Field
Line Integer Field

mEmployee="A001"
mSerial=1
mLine=1

mDataRow = mTable.Rows.Find(.....)

How do I put the above three variables in the Find command ?

Thanks
Mike TI
 
A

Armin Zingler

MikeTI said:
October 14, 2009

Hi all

I want to find a row from a DataSet table whose primary field consists of
three fields:

Employee Character Field
Serial Integer Field
Line Integer Field

mEmployee="A001"
mSerial=1
mLine=1

mDataRow = mTable.Rows.Find(.....)

How do I put the above three variables in the Find command ?

Thanks
Mike TI


mdataRow = mTable.Rows.Find(new object(){"A001", 1, 1})

if mdataRow is nothing then
'not found
else
'access mdataRow
end if
 
A

Alcibiade

----- Original Message -----
From: "Armin Zingler" <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.vb
Sent: Wednesday, October 14, 2009 1:43 PM
Subject: Re: DataSet Find Command



mDataRow = mTable.Rows.Find("mEmployee='A001' AND mSerial=1 AND mLine=1")
 
A

Armin Zingler

Alcibiade said:
mDataRow = mTable.Rows.Find("mEmployee='A001' AND mSerial=1 AND mLine=1")

Does this work? I thought the Find method expects the PK value(s), not an expresion.
 
T

Tom Shelton

Does this work? I thought the Find method expects the PK value(s), not an expresion.

It does - I'm thinking they meant the DataTable.Select method. You could also
use the new LINQ-to-DataSet stuff :)
 
M

MikeTI

Thank you everyone for the input.

In the meantime I tried the following and it worked.

Dim mKeys(2) As Object

mKeys(0) = mEmployee
mKeys(1) = mSerial
mKeys(2) = mLine
mDataRow = mTable.Rows.Find(mKeys)

Regards
Mike TI
 

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