getting the row number that contains unique data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a DataTable and I'm trying to locate some data in a specific column
(my primary key column). The data I'm looking for is an int called xFile. I
may have the correct way to find the xFile (I'm not sure), but if so, what
I'm ultimately trying to do is find the number of the row that xFile is in.

Here's what I'm hoping finds xFile:

DataRow foundRow = tCat.Rows.Find(xFile);

No matter how long I search online, I can't find how to simply retrieve the
row number containing this unique xFile.

Thanks for any help!!!!!!!!!
Mel
 
Hi there... There are three possible solutions for this (at least)...
1-. Iterate through the datatable, store in each loop the number of row
you're in (bad.. bad idea!!! and real slow... dismiss it)
2-. Add another column and make it autoincremental (let's call it...
RowID) so the table itself will maintain the number of row being inserted.
You already know what's the column (value) you're looking for... xFile
(BTW... where's Fox Mulder?!). Once you've found the row you're interested
in you can easily access the RowID column (this one works better and faster
than the previous)
3-. Why don't make xFile an autoincremental column?

Regards,
 
Back
Top