Skip to content

How to find a specific Row of a Table from a value

Carlos Sanchez

Asked Jul 27, 2004, 7:44 AM EDT5 answers
Share
LinkedInX
Hi everybody!! I want to know how to find a specific Row of a Table from a value. e.g. I've the string value of "myStringValue", how to know which row of "myTable" is having "myStringValue" in "Column1"? I there a simple method for this? Any Idea? Can somebody helps me? Thanx in advance. Carlos

4 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    DataRow[] drRes = myTable.Select("Column1 = '" & myStringValue &"'"); The result is the collection of DataRow objects.
    0
  • 0
    Sorry, my question wasn't so clear. I want to know the Index Row, I want to retrieve a int value. is this possible? thanx
    0
  • 0
    The index of the DataRow inside the DataTable? I don't think there is such a method.
    0
  • 0
    Well, thanx anyway. I'll have to do something like: int RowIndex; for (RowIndex=0; stringValue != myTable.Rows[RowIndex]["Column1"].ToString(); RowIndex++) {} Finally, IndexRow is having the Index Row that I want. it isn't the best code, but it works. If somebody else has a better idea, please post it. Thank you. Carlos
    0
  • 1 short reply
    • 0
      abc
      0