T
tshad
I am trying to create a list of 2 strings. 1st string would be a name and
2nd string would be the value.
Something like:
ArrayList s = new ArrayList();
string[,] s1 = new string[1,2];
s1 = {"City","NewPort Beach"};
s.Add(s1);
s1 = {"State","California"};
s.Add(s1);
s1 = {"Zip","92660"};
s.Add(s1);
Then I would do a foreach on the array into a Datatable (not sure how I
would set up the foreach) but in the loop would be something like:
DataRow dr = ds.Tables["Address"].NewRow();
dr["tagName"] = s2[0];
dr["tagValue"] = s2[1];
ds.Tables["Address"].Rows.InsertAt(dr,0);
I originally was going to just do an array of strings where the 1st index
would be the name, 2nd index would be the value and I would add that to the
DataTable. Then I would get the 3rd index and 4th index and do the same.
I wanted to see if it would be better to use an array list of 2 dimensions
to do the same thing.
Thanks,
Tom
2nd string would be the value.
Something like:
ArrayList s = new ArrayList();
string[,] s1 = new string[1,2];
s1 = {"City","NewPort Beach"};
s.Add(s1);
s1 = {"State","California"};
s.Add(s1);
s1 = {"Zip","92660"};
s.Add(s1);
Then I would do a foreach on the array into a Datatable (not sure how I
would set up the foreach) but in the loop would be something like:
DataRow dr = ds.Tables["Address"].NewRow();
dr["tagName"] = s2[0];
dr["tagValue"] = s2[1];
ds.Tables["Address"].Rows.InsertAt(dr,0);
I originally was going to just do an array of strings where the 1st index
would be the name, 2nd index would be the value and I would add that to the
DataTable. Then I would get the 3rd index and 4th index and do the same.
I wanted to see if it would be better to use an array list of 2 dimensions
to do the same thing.
Thanks,
Tom