DataSet Find Command

  • Thread starter Thread starter MikeTI
  • Start date Start date
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
 
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
 
----- 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")
 
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.
 
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 :)
 
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
 
Back
Top