Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point a way to obtain the a C# datatable row position after a successfull search in it?

Hi Experts

Could you point a way to obtain the a C# datatable row position after a successfull search in it?

             // The value is founded in DataSet using the key  val1
             DataRow[] foundRow = dsProdutos.Tables[tabela].Select("sb_pub =" +val1);

            // How to obtain   the DataSet's line position  that detains the value founded (?)

Open in new window


Thanks in advance.
Avatar of zephyr_hex (Megan)
zephyr_hex (Megan)
Flag of United States of America image

You can get the row index:

int index = dsProdutos.Tables[tabela].Rows.IndexOf(foundRow);

You'll want to verify foundRow is not null before you do this.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eduardo Fuerte

ASKER

Thank you Fernando!
Not a problem Eduardo, glad to help.