arrays

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

Guest

I have a two dimensional array. The first dimension is a
number, and the second dimension is a string. Given the
second dimension's value (String), how do I search for the
first dimension?
Thanks for all your inputs.
 
I have a two dimensional array. The first dimension is a
number, and the second dimension is a string. Given the
second dimension's value (String), how do I search for the
first dimension?

Dimensions of arrays are never strings - could you give an example of
exactly what you mean?
 
thanks for the reply Jon. only after typing the question I
I realized that my question was wrong. I have a datatable
with several rows. The first column in the datatable has
integer values. The second column has String values. The
values in each row is unique.
Given the value of the second string column, how do we
retrieve the value from the first column. thanks a lot for
your help.
 
DataTable table = new DataTable();
// fill in table here

DataRow[] rows = table.Select("column2 = '" + "myval" + "'");
 
There are several ways to acomplish this
drarray = dt.Select("SecondColumnName='the_string_u_r_looking_for'") gives u
an array of rows
if you know for sure the string values are unique, you should get only one
item inthe array
then u can do drarray(0)("firstColumnName") which will give u the integer
 
Back
Top